Download the PHP package label84/laravel-tagmanager without Composer

On this page you can find all versions of the php package label84/laravel-tagmanager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-tagmanager

Laravel TagManager

Latest Stable Version Total Downloads

Easier way to add Google Tag Manager to your Laravel application. Including support for User-ID, E-commerce and Server Side Events (Measurement Protocol).

Laravel support

Version Release
11.x ^1.4
10.x ^1.4

Installation

Read the article on Medium.com for a more detailed instruction: Medium: Add Google Analytics to your Laravel application with Google Tag Manager.

1. Install package

Install the package

2. Add the head and body tag to your (layout) view

Add the head tag directly above the closing </head> tag and the body tag directly after the opening <body> tag.

3. Add the TagManagerMiddleware to your Kernel

Add the TagManagerMiddleware directly after the StartSession middleware in your 'web' middleware group.

4. Publish the config file

Publish the config file. This will generate a tagmanager.php file in your config directory.

5. Add your GTM ID to your .env

Go to https://tagmanager.google.com and copy the 'Container ID' of the account (it looks like GTM-XXXXXXX).

Usage

Events

You can also use the following methods. These will automatically set the correct event key and value.

You can find a list of recommended events on: https://support.google.com/analytics/answer/9267735?hl=en

User-ID

This package also supports the User-ID feature.

To start using the User-ID feature you've to add the TagManagerUserIdMiddleware in your 'web' middleware group directly after the TagManagerMiddleware.

By default the 'id' of the User model will be used. You change the key in config/tagmanager.php.

More information: https://developers.google.com/analytics/devguides/collection/ga4/user-id?technology=tagmanager

Ecommerce (GA4)

You can use the following snippets to trigger an Ecommerce event with Google Analytics 4 (GA4).

Ecommerce item

The TagManagerItem class allows you to easily create an Ecommerce item. You can set extra parameters with dynamic calls. Method names are used as keys and automatically converted to underscore case.

Example: create item

Ecommerce events

The items parameter can be a single TagManagerItem item or an array of TagManagerItem items. You can also use plain arrays if you don't want to use the TagManagerItem class.

Example: call event with item

More information: https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm

Server Side Events

The Google Analytics Measurement Protocol allows developers to make HTTP requests to send raw user interaction data directly to Google Analytics servers. This allows developers to measure how users interact with their business from almost any environment. Developers can then use the Measurement Protocol to:

Measurement Protocol

You need complete the general installation steps first, such as adding the .env variables, adding the head and body tags to your layout file and adding the TagManagerMiddleware.

Add the following extra variables to your .env file.

Add the following snippet to the head of your blade layout file (below the existing x-tagmanager-head tag).

You can view the events directly in the Google Analytics UI under Realtime > Events.

Measurement Protocol Debug Mode

You can enable the debug mode by calling the debug() method. This will return a JSON validation response instead of sending the request to Google Analytics. If there are any errors, they will be returned in the validation messages response. If there are no errors, the validation response array will be empty.

Tests

License

MIT


All versions of laravel-tagmanager with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package label84/laravel-tagmanager contains the following files

Loading the files please wait ....