fond-of-spryker / google-tagmanager
Google Tag Manager tracking integration for Spryker
Installs: 20 575
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 6
Open Issues: 2
Requires
- php: >=7.1
- fond-of-spryker/product-image-storage: ^1.1
- fond-of-spryker/tax-product-connector: ~1.3
- spryker/cart: ^5.2.0
- spryker/catalog: ^5.0.0
- spryker/kernel: ^3.0.0
- spryker/money: ^2.0.0
- spryker/product: ^6.0.0
- spryker/product-storage: ~1.5.0
- spryker/session: ~3.2.0
Requires (Dev)
- codeception/codeception: ^2.4
- fond-of-codeception/spryker: dev-master as 1.0.0
- php-coveralls/php-coveralls: ^2.1
- phpro/grumphp: ^0.14
- sebastian/phpcpd: ^4.0
- spryker/code-sniffer: ^0.12
- dev-master
- 4.0.3
- 4.0.2
- 4.0.1
- 4.0.0
- 3.0.27-RC1
- 3.0.26-RC1
- 3.0.25-RC1
- 3.0.24-RC1
- 3.0.23-RC1
- 3.0.22-RC1
- 3.0.21-RC1
- 3.0.20-RC1
- 3.0.19-RC1
- 3.0.18-RC1
- 3.0.17-RC1
- 3.0.16-RC1
- 3.0.15-RC1
- 3.0.14-RC1
- 3.0.13-RC1
- 3.0.12-RC1
- 3.0.11-RC1
- 3.0.10-RC1
- 3.0.9-RC1
- 3.0.8-RC1
- 3.0.7-RC1
- 3.0.6-RC1
- 3.0.5-RC1
- 3.0.4-RC1
- 3.0.3-RC1
- 3.0.2-RC1
- 3.0.1-RC1
- 3.0-RC1
- 2.5.2
- 2.5.1
- 2.5.0
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.1.0-RC2
- 2.1.0-RC1
- 2.0.3-RC1
- 2.0.2-RC1
- 2.0.1-RC1
- 2.0.0-RC1
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 1.0.0-RC1
- dev-feature/refactor
- dev-feature/paypal-refund
- dev-feature/v5
- dev-spryker_upgrade
- dev-feature/eec-refactor
This package is auto-updated.
Last update: 2024-11-28 18:04:34 UTC
README
Google Tag Manager integration for Spryker
Installation
composer require fond-of-spryker/google-tagmanager
1. Add the Container ID in the configuration file
// ---------- Google Tag Manager
$config[GoogleTagManagerConstants::CONTAINER_ID] = 'GTM-XXXX';
2. Enable the Module in the configuration file
// ---------- Google Tag Manager
$config[GoogleTagManagerConstants::ENABLED] = true;
3. Include the namespace as a core namespace in the configuration file
$config[KernelConstants::CORE_NAMESPACES] = [
[...]
'FondOfSpryker'
];
4. Add twig service provider to YvesBootstrap.php in registerServiceProviders()
$this->application->register(new GoogleTagManagerTwigServiceProvider());
5. Add the Twig Extension in the neccessary Twig Templates
Application/layout/layout.twig
between <head></head> tags
{% block googletagmanager_data_layer %} {{ dataLayer('other', {}) }}{% endblock %}
{{ googleTagManager('@GoogleTagManager/partials/tag.twig') }}
after <body> tag
{{ googleTagManager('@GoogleTagManager/partials/tag-noscript.twig') }}
Catalog/catalog/index.twig
{% block googletagmanager_data_layer %}
{% set params = { 'category' : category, 'products' : products} %}
{{ dataLayer('category', params) }}
{% endblock %}
Product/product/detail.twig
{% block googletagmanager_data_layer %}
{% set params = { 'product' : product} %}
{{ dataLayer('product', params) }}
{% endblock %}
Cart/cart/index.twig
{% block googletagmanager_data_layer %}
{{ dataLayer('cart', {}) }}
{% endblock %}
Checkout/checkout/partial/success.twig
{% block googletagmanager_data_layer %}
{% set params = { 'order' : orderTransfer} %}
{{ dataLayer('order', params) }}
{% endblock %}