stefandoorn / google-tag-manager-plugin
Google Tag Manager plugin for Sylius.
Installs: 200 540
Dependents: 2
Suggesters: 0
Security: 0
Stars: 20
Watchers: 3
Forks: 13
Open Issues: 3
Type:sylius-plugin
Requires
- sylius/sylius: ^1.9
- xynnn/google-tag-manager-bundle: ^3.1 || ^4.0
Requires (Dev)
- behat/behat: ^3.6.1
- behat/mink-selenium2-driver: ^1.4
- dmore/behat-chrome-extension: ^1.3
- dmore/chrome-mink-driver: ^2.7
- friends-of-behat/mink: ^1.8
- friends-of-behat/mink-browserkit-driver: ^1.4
- friends-of-behat/mink-extension: ^2.4
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.0
- friends-of-behat/symfony-extension: ^2.1
- friends-of-behat/variadic-extension: ^1.3
- lakion/mink-debug-extension: ^2.0.0
- lchrusciel/api-test-case: ^5.1
- matthiasnoback/symfony-dependency-injection-test: ^4.3
- phpspec/phpspec: ^7.0
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^1.2
- phpstan/phpstan-doctrine: ^1.0
- phpstan/phpstan-strict-rules: ^1.1
- phpstan/phpstan-symfony: ^1.0
- phpstan/phpstan-webmozart-assert: ^1.0
- phpunit/phpunit: ^9.5
- sylius-labs/coding-standard: ^4.0
- symfony/browser-kit: ^5.4 || ^6.0
- symfony/debug-bundle: ^5.4 || ^6.0
- symfony/dotenv: ^5.4 || ^6.0
- symfony/intl: ^5.4 || ^6.0
- symfony/web-profiler-bundle: ^5.4 || ^6.0
- vimeo/psalm: 5.8.0
Suggests
- stefandoorn/google-tag-manager-enhanced-ecommerce-plugin: Integrate Sylius with Google Analytics Enhanced Ecommerce
- dev-master
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.1
- v1.0.0
- v0.5.0
- v0.4.0
- v0.3.0
- v0.2
- 0.1
- dev-dependabot/composer/vimeo/psalm-5.13.1
- dev-ecs
- dev-dependabot/add-v2-config-file
- dev-dependabot/composer/xynnn/google-tag-manager-bundle-tw-3.0
- dev-dependabot/composer/phpspec/phpspec-tw-7.0
- dev-dependabot/composer/friends-of-behat/symfony-extension-tw-2.0.11
- dev-dependabot/composer/symfony/web-profiler-bundle-tw-5.0.5
- dev-dependabot/composer/symfony/debug-bundle-tw-5.0.5
- dev-dependabot/composer/phpunit/phpunit-tw-8.5.2
- dev-dependabot/composer/se/selenium-server-standalone-tw-3.141
- dev-dependabot/composer/phpstan/phpstan-shim-tw-0.12.0
- dev-travis-ci
This package is auto-updated.
Last update: 2024-10-10 12:19:31 UTC
README
Related plugins
- Enhanced Ecommerce plugin: allows you a smooth integration with Google Analytics Enhanced Ecommerce.
Installation
1. Composer
composer require stefandoorn/google-tag-manager-plugin
2. Load bundle
Add to the bundle list:
new GtmPlugin\GtmPlugin(),
3. Follow installation instructions of required sub bundle (https://github.com/xyNNN/GoogleTagManagerBundle)
Add to your configuration:
google_tag_manager: enabled: true id: "GTM-XXXXXX" autoAppend: false
And also configure the features you would like to use from this plugin:
gtm: inject: true features: environment: true route: true context: true events: true
In case you set autoAppend
to false & also disable the inject
setting inside this plugin, you have to manage loading of the GTM container yourself.
In case you set autoAppend
to false & set inject
to true, be aware of the following:
Required output to your HTML (head, body & footer) are done through events. Make sure the following 'sonata_block_render_events' are present in your views:
sylius.shop.layout.javascripts
sylius.shop.layout.head
sylius.shop.layout.before_body
sylius.shop.layout.after_body
You can dump the default configuration using:
bin/console config:dump-reference GtmPlugin
5. Install assets (optional: only if you want to use events feature)
bin/console assets:install
bin/console sylius:install:assets
bin/console sylius:theme:assets:install
Features
environment
: Send Symfony/Sylius environment to GTMroute
: Send Symfony/Sylius route to GTMcontext
: Send Sylius context information to GTM (currency, locale, channel)events
: See below - allows you to register events easily from inside HTML using JS.
Usage
Register events from JS
var event = new GaEvent('category'); event.register(action, label, value);
Make sure also to listen for this specific event inside your GTM configuration.