stefandoorn / sylius-google-tag-manager-enhanced-ecommerce-plugin
Google Tag Manager Enhanced Ecommerce plugin for Sylius.
Installs: 115 278
Dependents: 0
Suggesters: 0
Security: 0
Stars: 33
Watchers: 8
Forks: 19
Open Issues: 7
Type:sylius-plugin
Requires
- php: ^7.4 || ^8.0
- stefandoorn/google-tag-manager-plugin: ~1.0
- sylius/sylius: ^1.9
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
- 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
- polishsymfonycommunity/symfony-mocker-container: ^1.0
- 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.12.0
- dev-master / 2.0.x-dev
- v2.0.0-alpha.14
- v2.0.0-alpha.13
- v2.0.0-alpha.12
- v2.0.0-alpha.11
- v2.0.0-alpha.10
- v2.0.0-alpha.9
- v2.0.0-alpha.8
- v2.0.0-alpha.7
- v2.0.0-alpha.6
- v2.0.0-alpha.5
- v2.0.0-alpha.4
- v2.0.0-alpha.3
- v2.0.0-alpha.2
- v2.0.0-alpha.1
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.0
- v0.10.0
- v0.9.0
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.0
- v0.6.1
- v0.6.0
- v0.5.0
- v0.4.0
- v0.3.3
- v0.3.2
- v0.3.1
- v0.3
- 0.2.2
- 0.2.1
- 0.2
- 0.1
- dev-view_cart
- dev-begin_checkout_at_other_step
- dev-fix-purchase-gtm
- dev-feat/listen-only-to-shop-requests-for-cart
- dev-ga4
- dev-dependabot/composer/phpspec/phpspec-tw-7.1
- dev-dependabot/add-v2-config-file
- dev-dependabot/composer/friends-of-behat/symfony-extension-tw-2.0.11
- dev-dependabot/composer/symfony/debug-bundle-tw-5.0.5
- dev-dependabot/composer/symfony/web-profiler-bundle-tw-5.0.5
- dev-dependabot/composer/phpunit/phpunit-tw-8.5.2
- dev-rename-namespace
- dev-product-details-via-separate-event
This package is auto-updated.
Last update: 2023-05-31 08:11:02 UTC
README
Note
This plugin now supports both UA (deprecated by Google) & GA4. Not all GA4 features are already implemented.
The following migration guide has been used to move to GA4: https://support.google.com/analytics/answer/10119380?hl=en
Installation
1. Composer
composer require stefandoorn/sylius-google-tag-manager-enhanced-ecommerce-plugin
2. Follow installation instructions of required sub bundle
https://github.com/stefandoorn/google-tag-manager-plugin
3. Load bundle
Add to bundles.php
:
StefanDoorn\SyliusGtmEnhancedEcommercePlugin\SyliusGtmEnhancedEcommercePlugin::class => ['all' => true],
4. Adjust configurations
Configure the features you would like to use/not. Find a base configuration reference by running:
bin/console config:dump-reference SyliusGtmEnhancedEcommercePlugin
5. Install assets
bin/console assets:install
bin/console sylius:install:assets
bin/console sylius:theme:assets:install
By default all features are enabled.
Features
Features available:
For Universal Analytics (deprecated by Google):
- purchases: Send purchases to GTM.
- product_impressions: Send impressions on product listings to GTM
- product_detail_impressions: Send impression on product detail pages to GTM
- product_clicks: Send click events on product links to GTM
- cart: Send add to cart / remove from cart events to GTM
- checkout: Send checkout steps & selected options to GTM
For GA4:
References + examples of how to set-up your GTM container: https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm
Supported events:
add_to_cart
remove_from_cart
view_cart
begin_checkout
add_shipping_info
add_payment_info
purchase
Other features included in UA, but not in GA4, are Work In Progress.
Make sure to check that the required 'sonata_block_render_events' template events are available. Check the
src/Resources/config/features/*.yml
& src/Resources/config/services.yml
for the definitions.
This is only to be checked if you've been overriding templates yourselves.
Bootstrap a GTM container (Universal Analytics (deprecated by Google))
You can find a GTM container fully configured that work with the test application in docs/UA/GTM-EXAMPLE.json
.
This file can be imported to easily configure your container.
It will add thoses tags and triggers
You will have to replace the UA-111111111-1 by your own Universal Analytics ID
Features not supported (yet):
promotion_impressions
: https://developers.google.com/tag-manager/enhanced-ecommerce#promo-impressionspromotion_clicks
: https://developers.google.com/tag-manager/enhanced-ecommerce#promo-clicksrefunds
: https://developers.google.com/tag-manager/enhanced-ecommerce#refunds
Cache Resolvers
It might be that your data resolvers give a performance hit, e.g. on the product show page.
There are decorators available that allow you to cache the results for a set time in order. Take a look
at the service definitions in cache_services.yml
& the default configuration on how to enable this setting.