Opencart Google Tagmanager Extension
Troubleshooting
Troubleshooting
Extension not working
Make sure that the Modification cache and any other cache is cleared after setting up the extension.
Design Theme Editor Why not?
The Opencart 3 features a Theme design editor where you can edit you twig files like the header, footer or any part of the template.
If is convenient way for users to edit the template directly. No matter how good it sound there is an issue Opencart dev's haven't fixed it. If the template is modified via Theme design editor which is saved in a database, the OCMOD modifications no longer applied to it.
So all the extensions that are not working on your site after installing, it might be you have twig files modified and the ocmod changes no longer applies.
Design Theme How to fix it:
Important: Make a backup of the file.
- Edit the desired file with the changes you have made copy entire text/p
- Use a text editor to edit your theme files in catalog/view/theme/THEME NAME/template/
- Paste the entire text you have copied removing the existing codes and save it
- Remove the entry on the Admin-Design-Theme for that file
- Refresh the modification cache
Where is the JSON import file
The JSON import file is provided with the download in TAG MANAGER IMPORT FILE folder named: GTM_workspace-import.json
if you are unable to find the file please open a support ticket requesting the file.
Trouble shooting header.php
Our extension heavely rely on header.php 90% of tags being handled here, so if our codes are not properly installed our extension won't work. We have changed the index() function to handle incoming data. This will cause trouble for other extension searching for public function index() { reference.
You can fix any of these extension by changing the ocmod xml like this:
<search><![CDATA[public function index() {]]></search>
<add position="replace"><![CDATA[
repalce with
<search regex="true"><![CDATA[/((?:public\ function\ index)(?:.*)(?:\))(?:\{))/]]></search>
<add><![CDATA[$1
PHP Error: call to a member function isActive() on null
If you are getting this error:
PHP message: PHP Fatal error: Uncaught Error: Call to a member function isActive() on null in /var/www/vhosts/xxxxxxxx/catalog/controller/extension/analytics/tagmanager.php:34
You need to refresh the OCMOD modification cache after installation. The Opencart is not able to load the required libraries due to missing ocmod changes.
TikTok Pixel Duplicate Events
If you are receiving duplicte events for TikTok make sure that you have setup the pixel correctly.
Advance Matchmaking should be off, the Event tracking type 'Custom' and if you have setup event tracking using Event Builder tool you need to remove them
No Tracking codes
Make sure the ocmod is applied, extension is enabled.
Call you site i.e. https://demo.aits.xyz?debug=show
If you see an Array data output with all the varible details that means the extension is active but the theme part is not working.
Make sure that your template have the Analytics section intact and present
For Opencart .tpl it should be something like this in header.tpl
<?php foreach ($analytics as $analytic) { ?>
<?php echo $analytic; ?>
<?php } ?>
For Opencart header.twig
{% for analytic in analytics %}
{{ analytic }}
{% endfor %}
If you do not see it there you can add these.
Opencart 2.0x to 3.0x only