Our website is a blog site, and on each blog article, I'm trying to send "article category" as a custom dimension in Google Analytic.
I already set it successfully like this:
ga('set', 'dimension1', 'category1');
but I wonder if an article has multiple categories, for example, an article may belongs to "News" and "Healthy", can I send both category to "dimension1"?
just change the values you want to dimension one.
ga('set', 'dimension1', 'news');
ga('set', 'dimension1', 'cats');
ga('set', 'dimension1', 'dogs');
Related
Is there a way within analytics to have a specific page title display in place of (not set)?
I have several different items categorized as the page title (not set).. For example can I get randomlink/index to automatically assign to the page title "Landing Page" rather than (not set) within analytics?
Can this be done through content grouping or other methods?
The data already collected in Google Analytics can not be changed.
You can assign a value, in each page on the website that doesn't have a title, for future hits by providing a custom 'title' using the ga('set' script
eg:
ga('create', 'UA-XXXXX-Y', 'auto');
(...)
if (!document.title) {
ga('set', 'title', 'my custom title');
}
(...)
ga('send', 'pageview');
Make sure this code runs before a pageview is sent.
https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#title
I'm setting up UserID tracking in Google Analytics. Google's documentation displays this piece of code to push UserIDs into analytics:
ga('create', 'UA-XXXX-Y', { 'userId': 'USER_ID' });
ga('send', 'pageview');
However, when I'm in my Google Analytic's settings area, it displays the following piece of code to include UserIDs.
ga(‘set’, ‘&uid’, {{USER_ID}}); // Set the user ID using signed-in user_id.
What is the difference between set and create? Do they both achieve the same result?
Both of them should work. Including the user id in the 'create' call includes setting it as well.
ga('create', 'UA-XXXX-Y', {'userId': 'USER_ID'});
ga('send', 'pageview');
is equivalent to
ga('create', 'UA-XXXX-Y');
ga('set', '&uid', {{USER_ID}}); // Set the user ID using signed-in user_id.
ga('send', 'pageview');
If you do copy and paste provided in GA, then you will need to change the smart quotes to straight quotes, because smart quotes will break GA.
I would like to disable Campaign Tracking on my GA property. I use Universal Analytics.
I've seen documentation here about method "_setCampaignTrack"
https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiCampaignTracking#_gat.GA_Tracker_._setCampaignTrack
But I'm wondering how I implement it in GA Universal.
I've tried this code:
ga('create', 'UA-37650441-9', 'auto');
ga('set','_setCampaignTrack', false);
ga('send', 'pageview');
So I added
ga('set','_setCampaignTrack', false);
But I'm not sure...please help me! ;)
Any suggestions would be really appreciated.
Thanks.
_setCampaigntrack was part of the older asynchronous code and I don't think that will work. AFAIIK there is no (documented) option to disable campaign tracking in Universal Analytics (looking at the field reference confirms this).
However you could override the campaign name/medium/source-fields with the respective set field calls:
ga('set', 'campaignName', '(not set)');
ga('set', 'campaignSource', '(not set)');
ga('set', 'campaignMedium', '(not set)');
or do the same thing via filters in your view settings. That should give a similar result.
I am new to GOogle Analytics. I have a single page site. It has multiple tabs that are reflected in the URL. Main url is index.html and if you switch to a different tab the URL becomes index.html?FaqPage
Is there a way to setup Google Analytics to give analytics on all the tabs seperately? I tried
ga('send', 'pageview', '/index.html');
But the analytics only seem to track index.html and not any of the ther URLs.
Also tried the following (with proer tracking code) but doesnt seem to work:
ga('create', 'UX-xxxxxxx-x', 'auto');
ga('set', { page: '/index.html?FaqPage', title: 'Faq'}, { page: '/index.html?MemberPage', title: 'Member'});
ga('send', 'pageview');
You're on the right track. One solution is to send a virtual pageview whenever a tab is clicked:
ga('send', 'pageview', '/faqpage')
And do similarly for all your tabs. Here is some more info https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications.
I am trying to configure my blog and the analytics code for it. There are multiple authors in my blog. What I am trying to do is aggregate the number of views by separate authors.
This is what I did
Went to my Analytics Admin and from there, for my Web Property I created a Custom Dimension from Custom Definitions.
The custom dimension is creted with Index 1 and the scope is "Hit". It is shown in the image above.
Then for the analytics code, that I place in the posts of my Blog, I placed the following code:
<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-XX', 'myblog.com');
ga('send', 'pageview', {
'dimension1': 'Author Name'
});
</script>
I've placed my value for UA-XXXXXXX-XX, myblog.com and Author Name.
It has been almost a month since I've been scratching my head and hoping that the code would work. But I don't see any stats in my Analytics > Audience > Custom > Custom Variables / User Defined. I hope it is there where I am supposed to look.
So, where did I go wrong? I would be highly greatful if someone would point out what I missed.
It looks like you've named your custom dimension "Custom Dimension Name" when it should be "Author" and you'll need to add the server-side variable as the value for dimension1.
For example, if you're using WordPress, your code would look like:
ga('send', 'pageview', {
'dimension1':'<?php the_author(); ?>'
});
Also, your custom dimension scope should be set to hit.