🚨 Discontinued 🚨
Please consider using https://github.com/spatie/laravel-googletagmanager.
Laravel Google Tag Manager
Google tag manager features including events, ecommerce, and dataLayer support
Authors: Andrew Mc Cormack, Simone Todaro
Installation
Composer
Require this package with composer:
composer require cyber-duck/laravel-google-tag-manager
Framework
Add the following to the list of service providers in your config/app.php file
'CyberDuck\LaravelGoogleTagManager\GTMServiceProvider',
Add the following alias to your config/app.php file
'GTM' => 'CyberDuck\LaravelGoogleTagManager\Facades\GTM',
Publish configuration file:
php artisan vendor:publish --provider="CyberDuck\LaravelGoogleTagManager\GTMServiceProvider"
Configure your GTM-XXXXX ID in config/gtm.php
Usage
Within your main blade layout template include the GTM blade template
@include('tracking::gtm')
Pushing additional data
\GTM::data('paramName', 'paramValue')
Pushing an event
\GTM::event('eventName')
Flashing data for the next request
\GTM::flash()
return redirect()->action('...');
Enhanced Ecommerce
Coming soon!!!