Analytics
2K members online now
2K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

google analytics (not set) - problem

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

hello,

 

i have content grouping running on my webpage, the code is the next one:

1. google analytics script

2. onloadevent function with this code:

     var scatcms = $('ul.breadcrumb li:nth-child(2) a').text();  --------> this is to get my category name
     ga('set', 'contentGroup1', scatcms);

 

now, this code is on the <head> of every page.

when i go to analytics, i can see various categories, like "Mundo", "Lifestyle", ....

 

there is also a (not set), and this should contain, for example, the homepage, but what is happening is that it contains all the pages.

 

example:

 

Category          Sessions

----------         ---------

 

(not set)            10,427 ---> in this number there is pages from Mundo category, or lifestyle category

Mundo               1

Lifestyle             2

 

 

can someone help, why is this happening??

thanks

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Diogo C
February 2016

Re: google analytics (not set) - problem

Top Contributor
# 6
Top Contributor
Hi,

yes you can do that but his is also a delayed hit as pageview will be sent on onload event. The issue here is that you scrape the DOM while the best way to proceed would be to provide the CG value as early as possible.

Kind regards,
Zorin
Web analyst @ escapestudio.net

View solution in original post

Re: google analytics (not set) - problem

A T
Participant ✭ ✭ ✭
# 2
A T
Participant ✭ ✭ ✭
Hi,

GA configurations only work moving forward on the incoming data and not on previously processed data.

Best Regards,
GA Guru.

'Star' or 'Accept as Solution' if it helped.

Re: google analytics (not set) - problem

Top Contributor
# 3
Top Contributor
Hi Diogo,

your CG set needs to be set before the pageview - if it is not the CG value will not be sent to GA thus you will have a lot of not set.

So one option is to give the CG info as early as the GA tracking code executes or delay GA code to onload yet I would not advise that as it creates a dependancy which can reduce the amount of data collected.

(not set) means no data has been passed to GA.

Kind regards,
Zorin
Web analyst @ escapestudio.net

Re: google analytics (not set) - problem

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
hi, thanks for the quick answer.

ok so right now i have this:

&lt;script&gt;
(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-31641753-16', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');
&lt;/script&gt;

&lt;script&gt;
onLoadEvent(function (){
var scatcms = $('ul.breadcrumb li:nth-child(2) a').text();
ga('set', 'contentGroup1', scatcms);
&lt;/script&gt;


delaying the GA code i also belive that is not a good option.

so can i do like this:

&lt;script&gt;
(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-31641753-16', 'auto');
ga('require', 'displayfeatures');

&lt;/script&gt;

&lt;script&gt;
onLoadEvent(function (){
var scatcms = $('ul.breadcrumb li:nth-child(2) a').text();
ga('set', 'contentGroup1', scatcms);

ga('send', 'pageview');

&lt;/script&gt;


thanks again

Re: google analytics (not set) - problem

A T
Participant ✭ ✭ ✭
# 5
A T
Participant ✭ ✭ ✭

Hi,

Yes. Post update :

You can easily debug on the website with GA debugger:
https://chrome.google.com/webstore/detail/jnkmfdileelhofjcijamephohjechhna

You can check in chrome, console tab with 'Preserve log' turned ON.

Best Regards,
GA Guru.

'Star' or 'Accept as Solution' if it helped.
Marked as Best Answer.
Solution
Accepted by topic author Diogo C
February 2016

Re: google analytics (not set) - problem

Top Contributor
# 6
Top Contributor
Hi,

yes you can do that but his is also a delayed hit as pageview will be sent on onload event. The issue here is that you scrape the DOM while the best way to proceed would be to provide the CG value as early as possible.

Kind regards,
Zorin
Web analyst @ escapestudio.net