- Posts: 13
COMMUNITY FORUM
Google Tag Manager event tags & K2 conflict
- Irene Sutherland
-
Topic Author
- Offline
- New Member
Are you aware of any known conflicts between K2 and Google Tag Manger event tags?
I have K2 and GTM installed on catholicenquiry.com.
While the All Pages Universal Analytics tag is firing okay, event tags are not.
By a process of deduction, I have discerned that K2 appears to be blocking them.
Are you able to tell me if there is any setting in K2 that will allow the GTM tags to fire - or is it a programming issue?
Best regards
Rene
Irene Sutherland
Australian Catholic Bishops Conference
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Unfortunately I am not aware of this extension. can you share a link towards a tag view?
Please Log in or Create an account to join the conversation.
- Irene Sutherland
-
Topic Author
- Offline
- New Member
- Posts: 13
Thanks very much for getting back to me. :)
Google Tag Manager (GTM) isn't an extension, it's a Google application that allows you to control event and other tags and generally read the analytics on your site. It can work with any analytics solution, but I'm using it in conjunction with Google Analytics .
What connects Google Tag Manager to your site is a snippet of code - although I'm using a plugin called Google Tag Manager , which inserts the snippet of code just after the <body> tag. All you have to do is place your GTM ID in the relevant field in the plugin.
I've set up GTM on a number of my sites. I've been able to get event tags firing on the non-K2 sites, but not on catholicenquiry.com, which uses K2 for articles.
There can be a range of reasons that tags don't fire and one common reason can be JavaScript library conflicts .
It would seem to me that this may be where the problem lies.
I'm wondering if you know of any setting in K2 that I might be able to change in order to avoid this conflict.
I'm sure, in time, other users of K2 will want to use GTM and will find your answer useful.
Thanks again
Rene
PS I had searched the forum first. :)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Is this the code?
<script type="text/javascript">
dataLayer = [];
</script>
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-TKZDTJ" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script type="text/javascript">
(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='//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-TKZDTJ');
</script>
<!-- End: gtm -->
I cannot see any JS errors in your site, but I cannot see any analytics code, only some HTML comments.
K2 by default does not load analytics, how are you loading them in this site?
Please Log in or Create an account to join the conversation.
- Irene Sutherland
-
Topic Author
- Offline
- New Member
- Posts: 13
Thanks for taking a look.
There is no deployment of GA code when you use GTM.
You put GTM code on your site, which then speaks to GA. The way I'm getting GTM code into the site is with the GTM plugin.
I'm not suggesting there's JS errors - rather that there may be a JS library conflict.
Please have a look at this article: www.simoahava.com/analytics/dont-gtm-listeners-work/
Rene
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
There are however multiple versions of jQuery from the mod_cn_photos, the mod_susnet_twitter and the mod_susnet_likebox modules.
This will cause issues in your site's functionality.
Please Log in or Create an account to join the conversation.
- Irene Sutherland
-
Topic Author
- Offline
- New Member
- Posts: 13
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Please Log in or Create an account to join the conversation.
- Irene Sutherland
-
Topic Author
- Offline
- New Member
- Posts: 13
I had a look at the modules you'd listed (mod_cn_photos, the mod_susnet_twitter and the mod_susnet_likebox).
I had tested for them by firstly disabling them on the page I was testing GTM. I found it made no difference.
It was only when I set up an article (that is using Joomla core Articles rather than K2 Items) - with those modules enabled, that I found GTM worked. That is why I have confidently narrowed it down to being a K2 Items issue.
Got any more thoughts on what might be happening here?
Thanks in advance
Rene
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
I don't think that K2 is causing this. I am not aware about how Google Tag Manager works but does use the recommended "event.preventDefault()" for it's events.
Do you see any errors in the browser console? Maybe there is a conflict as Krikor suggested.
Please Log in or Create an account to join the conversation.
- Irene Sutherland
-
Topic Author
- Offline
- New Member
- Posts: 13
Thank you so much for spending the time to look at this.
I found what the problem was and I feel somewhat embarrassed that I took up your time.
The issue was I'd set a trigger in GTM to not include URLs that contained catholicenquiry (the site URL catholicenquiry.com) to exclude internal links. We found that even though the links were to external sites, the linking was routed through weblinks - therefore being routed through a URL containing catholicenquiry.
I have since changed the configuration of the trigger to be "containing - weblinks". (and for the benefit of GTM users, I've set the tag label to "Click Text").
Thank you and apologies again for taking up your time on this.
Best regards
Rene
Please Log in or Create an account to join the conversation.
- Irene Sutherland
-
Topic Author
- Offline
- New Member
- Posts: 13
Thank you so much for taking the time to look at this.
I have found, much to my embarrassment, that it is not a K2 issue.
We found that the problem was weblinks. As the tag was to track clicks on external links, I had set the condition for the trigger to exclude links that contained catholicenquiry (so that internal linking isn't captured). As weblinks routs users through internal linking, the trigger wasn't firing as the URL it was being routed through contained catholicenquiry.
I have since changed the trigger to fire when the click URL contains weblinks and it now works like a dream.
Thanks and humble apologies again.
Rene
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.