Google analytics (via tag manager) loses track of adwords visitors after first pageload

与世无争的帅哥 提交于 2019-12-03 08:09:03

We at betabrand.com are having very similar troubles.

Last month we switched from a multipage to a single page app using angularJs and immediately starting getting bad advertising revenue tracking both Universal Analytics and Google Analytics.

We are also using Google Tag Manager to fire off our events.

Our current lead is a tidbit from https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications

Which states:

Do not update the document location

In the same way that the tracker uses document.referrer for the referrer field, it uses document.location for the location field, which will often contain campaign data or other meta data in the form of query parameters appended to the end of the URL.

Updating any of the campaign fields or other meta data that Google Analytics is checking for may cause the current session to end and a new session to begin. To avoid this problem, do not update the location field when tracking virtual pageviews in a single page application. Use the page field instead.

It also includes this note

Note: if you send a hit that includes both the location and page fields and the path values are different, Google Analytics will use the value specified for the page field.

To us, this says that if you include the 'page' field it will trump a 'location' field value and that if you include a 'location' field without a 'page' field after the initial page load you run the risk of starting a new session possibly with the campaign tracking stripped.

Using the google analytics debugger chrome extension we were able to identify events that were indeed firing a location parameter and without a page parameter.

A user hits our page, GTM fires a page view with the 'location' parameter. Subsequent virtual page views were including both 'location' and 'page' parameters. However we were also firing an event when a user opens their shopping cart that and that includes a 'location' parameter and not a 'page' parameter.

We just updated our GTM configuration to try to remedy this and have our fingers crossed that it will work. I'll update my post if we find a solution.

We've been wrestling with this for WAY too long now.

I'm facing the same problem (currently implementing the solution.. only did some research) and it might have something to do what Google only is mentioning in their docs briefly, namely: Do not create new trackers. GTM does create a new tracker each time..

Possible solution

Do not let GTM initiate a new tracker each time but set trackerName in GTM like 'spaTracker' for your Single Page App.

All credits go to Thyngster.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!