IMPORTANT: Before continuing, make sure that your store does not have any inserted codes which Google Tag Manager will reinsert. ELIMINATE or DISABLE any code or you will have conflicts or unwanted duplicate statistics.
Installation of GTM in Google Chrome
Before attempting the fixes, we will need to have installed some extensions into our Google Chrome browser, here is the link to download each one plugin:
- Tag Assistant (by google) - This will help us to see what labels have been executed from our Google Tag Manager code and possible errors.
- Google Analytics Debugger - This will help us see what data is being sent to our Google Analytics account and possible errors.
- Facebook pixel helper - (if you are using Facebook Pixel) This will show us information about the Facebook pixel that is being executed in our views and possible errors being caused.
- UET Tag Helper - (if you are using Bing Ads) This will help us see what data is being sent through our transactions via our Bing account.
Google Tag Manager "Preview" mode
From our Google Tag Manager account we can enable the "Preview" mode, which, once enabled, will allow us to see "live" all the information of our Google Tag Manager code:
- Value of the Datalayer.
- Tags which were released.
- Tags which were not released.
- Label information.
Once logged in the Google Tag Manager panel, click on the gray "Preview" button, the page will be updated and an orange box will appear from which we can update the preview mode if necessary or end the "Preview" mode.
We return to the public part of our website and update the page (for more security, we update by pressing CTRL + F5 to make sure we have also deleted cache), We will see that a new window appears at the bottom, where we will find all the information on our Google Tag Manager tag.
Important This mode will ONLY be visible on the computer that activated the "Preview" mode, other visitors to your store will NEVER see this mode.
Basic tests and solutions
1.- Is GMT inserting the Google Tag Manager code?
This is the most important part, because if Google Marketing Tools is not inserting the Google Tag Manager code, no tag will be executed.
Google Tag Assistant will not detect any tag when we enable it and update the page:
You will find below a list of the most common errors:
- Have you installed Google Marketing Tools correctly? Check the documentation on how to install Google Marketing Tools, remember that if your version of Opencart is between 1.5.x to 18.104.22.168 you have to perform an additional action in the file "/index.php". For Opencart 2 and 3 users, the "Google Marketing Tools" modification must exist in "Extensions > Modifications".
- Have you enabled Google Marketing Tools and inserted your GTM ID (GTM-XXXXX)?
- Do you have an external cache generation system? If you have a cache generation system installed, make sure that you have re-generated the cache, to make sure it is not a problem with this cache generator, disable it and try again.
- Are you using Opencart 3.x? check the default cache: Opencart 3.x incorporates a default cache system, make sure that you have reset it from the administrator's dashboard, in a button located on the top right that contains a gear.
- Have you edited the file "header.twig" or "footer.twig" from "Design> Theme Editor"? Opencart 3.x includes a system to edit template files, access this system to see if you have edited these files, if so, you have to move your changes to OCMOD and delete these files from this section. This problem will also affect other extensions that try to modify these files through OCMOD.
If all of these points are checked and Google Marketing Tools still does not insert the Google Tag Manager code, it could be due to the following reasons:
- Some errors exist in your OCMOD / VQMOD system.
- OCMOD / VQMOD can not find the corresponding code in your files "header.tpl / .twig footer.tpl / twig".
- Your template is using several types of layout for the header / footer, which are not in the default files "header" / "footer".
Information: If it is a problem that is not directly related to Google Marketing Tools, Our team can solve it for an additional fee. To discuss this issue further or request a quote please click HERE
2.- Is GMT detecting all my views correctly?
To make sure that the labels are collecting the correct data, we can check if the variable "current_view" in "Data Layer" has the correct value in all our views.
To know the value of "current_view", once we have enabled the "Preview" mode, in the "Data Layer" tab we can see the variable "current_view" if we scroll to "Current values ??of the Data Layer":
In this list you will find the value of "current_view" in the different views:
- Home: homepage
- Product view: product
- Search for product: search
- Category view: category
- Manufacturer view: manufacturer
- Cart view: cart
- Checkout view: checkout
- Successful order view: purchase
- Information view: information
- Record view: account_register
- View login: account_login
- Wish list view: wishlist
- View offers: special
- List view manufacturers: manufacturer_list
- View contact form: contact
If any of the views in "current_view" is not correct, it may be due to the following:
- Do you use any external SEO system? Google Marketing Tools is trying to translate the friendly URLs using the SEO system that comes by default in Opencart. If you are using an external SEO system, which is modifying the SEO functionality by default, it is possible that Google Marketing Tools is not translating the URLs correctly.
- Are you using an external checkout method? (only for "checkout") If your external checkout method is changing the default route of "index.php? route = checkout / checkout", Google Marketing Tools will not recognize that we are in the view of the purchase process.
- Are you using any extension that is modifying the "Successful Order" landing page? (only for "purchase") if this modification is changing the default successful order route "index.php? route = checkout / success", Google Marketing Tools will not recognize that we are in the successful order view.
Information: These incompatibilities are not directly related to Google Marketing Tools, since their third-party extensions are drastically changing the CORE of their platform, which means that Google Marketing Tools can not do its job correctly. Our team can solve it for an additional fee. To discuss this issue further or request a quote please click HERE
3.- Is GMT recording my conversions?
Check 1: To find out if Google Marketing Tools is recording conversions, the first thing to check if the "Successful Order" view is translated by GMT as "purchase", in the "current_view" variable of the Data Layer. Display the point "2.- Is GMT correctly detecting all my views?".
Check 2: There are indications of our order in "Data Layer":
CASE 1: The variable "current_view" is "purchase" but there are no indications of the order in Data Layer. This error can be due to:
- If so, you should know very well what are the default order statuses of your payment methods, because if for example you set the order states "Completed" and "Sent" as valid states for the conversion, but your method of payment "Against reimbursement" is establishing the default order status "Pending" to orders placed with this payment method, these orders will not be sent to Google Tag Manager so these conversions will not be registered. We recommend leaving this selector blank ("Nothing selected") so that all new orders are accepted.
CASE 2: The variable "current_view" is "purchase", there are indications of the order in Data Layer but the conversions are still not registered. This error can be due to:
- Did you generate, import and publish the Workspace after enabling conversion tags that are not recording data? Remember that if you have enabled or edited a label in the "GTM Workspace generator" tab of the Google Marketing Tools admin area, you must generate, import and publish the container again.
For example, if you have previously run a Workspace and decided to add "Google Ads", if you simply enabled and configured "Google Ads" in the Google Marketing Tools configuration area, the "GTM Workspace generator" tab will not work, since those changes are not applied to your Google Tag Manager account.
- Is it possible that the problem lies in the payment method you are using? It may be that the payment method you are using goes to an external payment gateway and does not automatically return to the "Successful Order" view after the client page, if the external payment platform does not have any configuration for redirection the only solution is to send the conversion manually from the Google Marketing Tools configuration area. If you use a default payment method (for example "Bank transfer") if everything worked well, it is a problem of your personalized payment method.
- Is it possible that the problem lies in your payment process? If you are using an external payment process, it is likely that you are modifying critical parts in the order record, since this data is stored in session and if your payment method uses its own methods and does not follow the CORE rules of Opencart, Google Marketing Tools will know that we have completed an order, but you will not find data about it. To rule out this problem, disable the external purchase process that you are using and use the one that comes by default in Opencart, if everything works, it is due to your external payment process.
Information: These incompatibilities are not directly related to Google Marketing Tools, since their third-party extensions are drastically changing the CORE of their platform, this means Google Marketing Tools cannot extract the data correctly. Our team can solve it for an additional fee. To discuss this issue further or request a quote please click HERE
4.- Are the cart events working?
To know if the events "add to cart" or "remove from cart" are working, we enable the "Preview mode", and perform the actions:
- Add a product to the cart from the "Category" view.
- Add a product to the cart from the "Product" view.
- Remove a product from the cart from the "Cart module".
- Remove a product from the cart from the "Cart" view.
If all goes well, the corresponding labels have to be activated when the action is performed, as shown in the following animation:
If any of the events does not work, it may be due to the following cases:
- None of the events are triggered: It is possible that your template is using its own libraries to manage the cart, therefore, Google Marketing Tools can not obtain the information of the product that has just been added to the cart and send the order to Google Tag Manager to activate the label.
- The "Add to cart" event does not trigger on the inside view of the product: Through OCMOD / VQMOD the necessary changes are being made in the product view to add the event in case the user has added a product to the cart, it is likely that your template is not respecting the Opencart CORE in the "product" view , and changes made by GMT through OCMOD / VQMOD can not be applied.
- Some events go off, another does not: It may be due to your template as we commented previously or to an external extension that you install to modify the default functionality of "cart".
information: These incompatibilities are not directly related to Google Marketing Tools, since their third party extensions / templates are drastically changing the CORE of their platform, which means that Google Marketing Tools can not do its job correctly. Our team can solve it for an additional fee. To discuss this issue further or request a quote please click HERE
Common errors and solutions
1.- Learn why GTM is inserted in some pages and not in others?
This can be due to any of the following situations:
- Cache: If you have an external extension that is generating a cache, to test this clear your cache or even deactivate the third-party extension to verify the problem. Remember that
- Opencart 3.x already brings your cache system by default, do the same with it.
- Modules force the controller "header" to load twice: Some developers do not respect the CORE of Opencart or have bad practices in their developments, sometimes we have found that some modules are inserted into particular layout parts (right column, left column, superior content ...) which makes OpenCart load the "header" (catalog / controller / common / header.php) driver more than once, which causes Google Marketing Tools to lose it's data which it has to insert into the view. To find out which module is responsible, one by one deactivate the inserted modules until you see that GTM has been inserted.
information: These incompatibilities are not directly related to Google Marketing Tools, since their third party extensions / templates are drastically changing the CORE of the platform, which means that Google Marketing Tools can not do its job correctly. Our team can solve it for an additional fee. To discuss this issue further or request a quote please click HERE
2.- Why are my conversions not being recorded?
You have all the information in the previous section "Basic tests and solutions".