Search
Other CDN for Joomla! questions
Forum

CDN for Joomla breaks Google Tag Manager js

Marco Meschieri's Avatar Marco Meschieri
CDN for Joomla changes the domain name in the Google Tag Manager Javascript
In practice, it modifies the Google Tag manager tracking script and invalidates it by changing the domain name to that of the CDN
It would be useful to have the possibility to exclude a particular string from the url transformation

This is my google tag manager code
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'//www.logicaldoc.com/gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WPRN9JJ');</script>
<!-- End Google Tag Manager -->

This instead is what results after the passage of CND for Joomla
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'//cdn.logicaldoc.com/gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WPRN9JJ');</script>
<!-- End Google Tag Manager --> 
Marco Meschieri's Avatar Marco Meschieri
In fact, the information I gave is not entirely correct, I deactivated the plugin and I saw that the transformation produced by the plugin is slightly different:


This is my google tag manager code (with the plugin deactivated)
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WPRN9JJ');</script>
<!-- End Google Tag Manager -->

This instead is what results after the passage of CDN for Joomla
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'//cdn.logicaldoc.com/gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WPRN9JJ');</script>
<!-- End Google Tag Manager -->

In practice CDN for Joomla adds the configured CDN domain to the url of the google script gtm.js which become //cdn.logicaldoc.com/gtm.js
instead of gtm.js
Peter van Westen's Avatar Peter van Westen ADMIN
You can wrap the script section in ... tags...
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription