This module is used to inject Google Tag Manager script and dataLayer collection
Add Scandiweb_Core if it is not added already by running
composer config repositories.scandiweb-module-core git git@github.com:scandiwebcom/Scandiweb-Assets-Core.git
composer require scandiweb/module-core:~0.1.2
Add the extension by running
composer config repositories.scandi-google-tag-manager git git@github.com:scandiwebcom/google-tag-manager.git
composer require scandiwebcom/google-tag-manager:1.0.26
php -f bin/magento setup:upgrade
Go to the Stores -> Configurations -> Scandiweb -> Google Tag Manager from the admin panel.
-
Ensure that module is enabled, switch to 'Yes', if required;
-
Add script and noscript snippets into appropriate fields;
-
Ensure that script is storing in the head, switch to 'Yes' if required;
-
Ensure you have jQuery selector which will be able to get all the products items on the category page ('ol.product-items > li.item.product-item' by default);
-
Configure your steps of the checkout, leave blank if one step checkout is used;
-
Leave field "Pagesize Limit for impressions" blank for now;
-
Clean cache and refresh the main page, inspect the page and search for 'Google Tag Manager'. It should be injected on the page;
-
Then open the browser console and type dataLayer (variable is case-sensitive) you should see object of dataLayer;
-
Go to the category page and check if amount of impressions are pushed correctly. If there is a difference from the expected amount - go to the configurations and enter maximum amount of products user can see on one category page in the "Pagesize Limit for impressions" -> Drop caches;
9.1. If you have amount switchers user can see on the category or search pages, and amount is pushed incorrectly, please contact aleksejt@scandiweb.com in order to report the problem.
-
Configure color, size variables to be named, as required;
-
Enter the brand, to be pushed with ALL of the projects (dynamic change will be added later);
-
If you want checkout options to be pushed, please enter ids to be used in jQuery selectors to select all radios.