Google Tag Manager with ChaplinJS - google-tag-manager

I am in the process of building a chaplinJS client app and needed capabilities to add google analytics.
I want to use Google Tag Manager (GTM) and added the tracking code to my html file. Then went on over to GTM and setup the PageView event tag.
For some reason none of the page view events after the initial load are trigged. Does GTM work with chaplinJS? I imagine its looking for url change and then pushes out a Universal analytics page view event.
Has anyone else done this? I suppose the other route could be to update application.coffee and listen for "route:match" event and then push out a pageview event. I figured its easier to do this with GTM because I can always add new tags as I go.
Thoughts?

I followed the approach listed here to get my pageView tracking working
http://decompile.it/blog/2013/06/21/integrating-google-tag-manager-and-google-analytics-in-a-single-page-application/

Exactly, throw virtual pageview event on every navigation and that should help getting all pages tracked.
I have used similar handling for my backbone single page application.

Related

Events dataLayer.push code in Google tag manager wordpress

I implemented GA4 using Google tag manager in wordpress without using plugin.But I don't where to add the dataLayer.push code for events like view_item_list, view_item, add_to_cart, remove_from_cart, view_cart.
Please say where to add the dataLayer.push code for these events. It will be useful for me if anybody shows the script with dynamic values.

How to apply Google Analytics (GA4) tracking code to every page in a Bubble webapp?

I am using the official GA4 plugin for Bubble.io. However there is only one tracking code field per app, while an app might consist of multiple pages. From what I understood, tracking code is to be applied to every page of the application. How do I gather data from each of the pages then? Thanks!
If you want to add a tracker to every page, within your app, navigate to Settings -> SEO/metatags and scroll down to Script/metatags in Header or Script in body to add your tracking snippet.

why google analytics include my click after I installed it by google tag manager?

I have installed google analytics by google tag manager, but every time I enter my website and click something, google analytics include my click. How can I solve this problem?
If you only need to track page views, make sure on Google Analytics tag inside your GTM you have firing rule set to only "All Pageviews".
Based on the event that you have mentioned, it looks like you have an additional firing rule available that is set to fire on "all clicks". You can check the GA tag if it has multiple firing rules, if yes.. you can only keep the pageviews one and remove the other.
If it is gtm.click then it should be just fine . I attached a screen shot here . If you see the something like this when you click any where on the page then it is fine . Gtm automaticlly trigger this event when you implement any onclick trigger
Inside my Google Analytics tag, I have only "All Pageviews" and I don't have any additional firing rule.
You mean that you have not faced the same problem?
To solve this problem, I followed the instruction on the link below and I was successful at excluding my traffic in Google Analytics.
https://www.rubenvezzoli.online/exclude-internal-traffic-google-analytics-using-google-tag-manager/

Basic Custom Event Tracking with Google Tag Manager and Analytics

I'm attempting to get a (in my opinion) very simple scenario working with Google Tag Manager and Analytics, and running into problems.
We have made a new Google Analytics (GA) universal analytics site.
We have made a new Google Tag Manager (GTM) container for our site.
We created a "tag" in GTM for our GA account, firing on "All Pages" to track page views.
Now we would like to track events using custom JavaScript, via the dataLayer. For example:
$('a').click(function() {
dataLayer.push({'event': 'linkclickedtest'});
});
This just isn't working, at all. If I watch Chrome's console/network tabs, no data seems to get sent to Google. I've also installed the Google Analytics debugger for Chrome and it doesn't show the event firing either. I must be missing something simple. Any guidance would be appreciated. Thanks!
You need to create a new GTM trigger based on the linkclickedtest event. Your tag should then be configured to fire on this new trigger.
Is jQuery loaded before executing this code? Try passing object to the dataLayer.push function as below:
$('a').click(function() {
dataLayer.push({'event' : 'linkclickedtest'});
});

Preventing trackPageView call in GA from GTM

We have many clients that are using Google Analytics (GA) via Google Tag Manager (GTM) on their website. My company provides AJAX pages for our client's site where we track user interaction using custom trackPageView calls. For regular GA code this was not a problem - we would set up the GA code in the static header, omitting the trackpageview call
<script type="text/javascript">
var _gaq=_gaq||[];
_gaq.push(['_setAccount','UA-5620270-1']);
</script>
and then whenever the user interacts with something on the AJAX portion of the page (initial page load, clicking options etc) we call trackPageView with a virtual URL
_gaq.push(['_trackPageview','/someurl?param1=abc&param2=def']);
The problem we have with GTM is that we are getting double tracking - the initial trackPageView call coming from GTM, then the virtual URL call on the AJAX portion of the page - on initial page loads. We can't disable the virtual URL on initial page loads on our end. We need to be able to get GTM to send through all the GA code (setAccount, domain name etc) except for the trackPageView bit. Is there any way to do this in GTM?
Not the most elegant, but easy to implement solutions:
pass a virtual url to the page call in GTM and set up a filter in your data views that excludes this url from the reports or
place your GA code in a custom tag instead of using a code template and omit the trackPageView-Call
I am not sure if this option is possible given your description, but virtual pageviews are not the best solution -- the total pageviews and related metrics are inflated and you cannot tell which segments are really engaging with the site more and which less.
Event tracking would be a smart way to do this. And with new GTM this is not difficult to setup at all. You could create all-new tracking (to the same account) and attach a string to your new tags, and then simply add include-only filter that will not allow any other requests.

Resources