Generic Google Analytics does not track pageviews and events when user ID is set
We are recently updating our system to work with google universal analytics. We ported the property to use universal analytics, and after a few days we made changes according to the guide: https://developers.google.com/analytics/devguides/collection/upgrade/guide
We have made changes to use the User-ID functionality. Every event or pageview is tracked fine, but goals are completed (which end when the user reaches a specific page).
We entered the user ID at noon on Aug 6, and as you can see, the day after the targets were 0 (although due to our database, I can tell it was around 25). The day after the (8th) goal (as mentioned earlier, page views with a set of user IDs) were tracked again. The 9th day was only a few (and there were many more). Not tracked from this day.
In the beginning, I thought it would take longer for analysts to combine data due to user ID, but it seems very strange to me.
The code I use is:
<!-- Google Analytics Universal-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-xxxxxxx-y', {
'cookieDomain': 'xxxxxxx.xx',
'siteSpeedSampleRate': 25
});
{% if userId is set %}
ga('set', '&uid', userId);
{% endif %}
ga('send', 'pageview');
Quite simple and I am also using the Google Analytics debug tool to check all data is sent and yes it is sent. In addition to this, if I land on a page that tracks a goal on its own, I can see my session in real time, so the data is sent to analytics.
This is why I think I am missing some configuration from the Google Analytics side. I have already created a user-id view and the data there contains the same information, but only since August 6th when the user id functionality was launched.
Does anyone have an idea or have the same problems?
Thank!
source to share
If you are using a debugging tool and have confirmed that the user ID is actually being sent as part of a hit in Google Analytics, then you are doing the right thing on your part.
I copied your exact code, replaced the variable userId
with a string 'foobar'
, and I was also able to verify that the hit was sent correctly, including the string 'foobar'
. This is how it looked:
http://www.google-analytics.com/collect?
v=1&
_v=j25&
a=1335799492&
t=pageview&
_s=1&
dl=http%3A%2F%2Flocalhost%2Ftest.html&
ul=en-us&
de=UTF-8&
sd=24-bit&
sr=2560x1440&
vp=1605x611&
je=1&
fl=14.0%20r0&
_u=cACAAET~&
cid=2022234602.1393626891&
uid=foobar&
tid=UA-XXXX-Y&
z=304825725
If the data is not showing properly in your reports and you are sure everything is configured correctly for your userId-enabled mode, then this may be an error, and if so, then it is best to do so. just report it to google.
The best place to post a bug is here:
https://code.google.com/p/analytics-issues/issues/entry
UPDATE (08/26/2014)
It looks like there is already a bug in this issue. You can view it here to be notified of fixes / updates: https://code.google.com/p/analytics-issues/issues/detail?id=477
source to share