Google Analytics not tracking data - google-analytics

We have a total of six websites. Three for two countries consisting of (mobile, desktop and store). Individual tracking code was created for each but after speaking to our developers they put a different code across each site so that we could combine the total set of data of each site in one report.
We have been navigating the sites and placing test orders but nothing is being picked up in GA Dashboard. Not in Real Time either.
Do we need to add each unique tracking code to each site? If So how can these be combined to make one complete report.
Each site has it's own unique code (example)
/* Google Universal Analytics */
(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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-01', 'auto');
ga('require', 'ecommerce');
ga('send', 'pageview');
</script>
But our devs have added the same code to all sites. Example
ga('create', 'UA-XXXXXXXX-12', 'auto');

[Partial answer here, as you may need to provide more code samples of your ecommerce implementation if want help debugging that.]
With the same tracking code across all sites, you effectively have a rollup property. But you will need to add specific filters so that can differentiate the traffic from one site to the other, so add a hostname prepend filter at least so that you see which site traffic is from.
If you want to see site specific data with the rollup property, you will need to create individual views for each site, in addition to your best practice views (eg. Test and Raw). Each site-specific view should have an include filter that only shows permits data for that specific site.
If you want to include an individual property for each site, then you will need to give that tracking object a specific name ( Google 'named trackers'), but at least you wouldn't need to create separate views in your rollup property.
To check your hits, use a tool like GA Debugger for Chrome, or check your developer's network tab for the GA requests.

Related

Multiple Tracking IDs for Single site without named tracker

In one of my client site, I am seeing multiple tracker IDs without any named tracker. I don't understand why we need multiple tracking IDs for single site?
ga('create', 'UA-XXXXXXXX-1', 'auto');
ga('create', 'UA-XXXXXXXX-2', 'auto');
ga('send', 'pageview')
I'm new to Google Analytics.
You do not need multiple tracking ids for a single site. This is simply an error. The second tracker instance will immediately overwrite the first one, and hits will be recorded for the second property only.

Can I pass google analytics marketing tracking code to a following page (when the landing page doesn't have GA code)

I am in a scenario where we are tagging up on part of the site (purchase.mysite.com) with GA tags but we aren't tagging up the main site (www.mysite.com).
The problem is that a lot of traffic that goes to purchase.mysite.com initially goes via www.mysite.com which means if a user lands on www.mysite.com with a marketing tracking code and then goes to purchase.mysite.com the tracking code will be lost and all traffic from this route will be considered referral.
Is there a way to still pass this marketing campaign code when the user hits purchase.mysite.com (other than adding GA code to the main site which we don't want to do)?
If not possible in GA, is there another technical solution like saving the tracking code in the cookie and then setting it when the user goes to purchase.mysite.com?
Any help would be greatly appreciated.
Thanks,
Frank
Frank,
Your final paragraph htis the nail on the head: save your campaign tracking data into your own cookie and then read this cookie when you're on a page with GA on it and manually set the campaign data. You only need to set it once and it will then propogate through for the whole session/user as per your requirements.
To set the campaign data manually, just use code such as this (ref: https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#campaignName)
ga('set', 'campaignName', 'My Campaign Name');
ga('set', 'campaignSource', 'anotherwebsite.com');
ga('set', 'campaignMedium', 'cpc');
ga('send', 'pageview');
notes
You must set at least Source & Medium for the data to register with GA
Medium has a fixed set of possible values as per this google doc: https://support.google.com/analytics/answer/1033173?hl=en

I am trying to set value for custom dimension in google analytics for my website

I'm new to google analytics and i don't realize how make it works.
We have a website and we want to capture the customerId as custom variable in google analytics in order to analyze the behavior of each user with the site.
For this, i start to use google analytics (analytics.js) a few days ago and i created a custom dimension (to know who user access).
The dimension was created with session scope because those values must be sent once per session.
After that, i add the code needed as is explained here:
ga('create', 'UA-#######-1', 'domain.com');
ga('send', 'pageview', { 'dimension1': '<%Convert.ToString(Session["SelectedCustomerID"]);%>' });
I've tried this code and others configurations but google analytics doesn't take the values.
What i'm doing bad? Please suggest me a way to capture the information.

Google Analytics: Grouping similar referrals without loosing source

Lets say I have 100 customers that bought a website from me. In the footer of their websites I have the text "Website developed by:" followed by a link that points to my company website. In Google Analytics for my company website these referrals will show up with the customers URL as source, and "referral" as medium. I would like all of the referrals from my 100 customer websites to be grouped, so that i can view the total metrics together. I have tried using utm_source="Customer Website" on the referral links, but the utm_source overwrites the default source (that is the customer website URL) so that there is no way for me to separate the different websites.
How can I set up this in Google Analytics so that I can both view all of the referrals from customer websites together and separately?
You can use utm_campaign=Customer-Referral and then see all this data under one campaign on Google Analytics.
You can direct the traffic to the destination page but with a dummy query string parameter such as www.example.com?ref=client, and then see the traffic that is directed to this specific page on Google Analytics.
Based on the ref, you can inject a user-level custom dimension that will show you data of that specific group. What you should add is ga('set', 'dimension1', 'Client Referral');
Add it to your tracking code before ga('send', 'pageview'); You need to send this data only once, at the first page view. You can read more about it here: https://developers.google.com/analytics/devguides/platform/customdimsmets
(note: I used dimension1 assuming that you don't have existing custom dimensions. If you already using slot no. 1, update it to another slot).

Google Analytics Cross-Domain Tracking with Multiple Trackers

I have a network of sites that are all on different domains and subdomains (domain1.com, sub.domain1.com, domain2.com, sub.domain2.com). Some of them already have Google Analytics trackers installed. Some do not have GA trackers at all.
I'd like to create a way to see a single GA account for the whole network, across domains, without disrupting existing single-domain GA tracking. Additionally, I need to be able to track visits and conversions across sites in the network as though they were a single site. Basically, you could think of it as a totally separate, independent GA account for the network.
I've seen that it's possible to auto-link domains (https://developers.google.com/analytics/devguides/collection/analyticsjs/cross-domain#autolink), thereby enabling network-wide analytics and conversion tracking, but is there a way to do this that won't disrupt the existing trackers already on the sites? Perhaps there's a way to make GA create two trackers with different cookies, one of which is cross-domain?
Ideally, I could give each site's developer a snippet of code to add to their site that would enable the network tracking. Is it possible?
Yes, this is possible. A couple of things to keep in mind though:
I have a network of sites that are all on different domains and subdomains (domain1.com, sub.domain1.com, domain2.com, sub.domain2.com). Some of them already have Google Analytics trackers installed. Some do not have GA trackers at all.
This shouldn't be a problem. Its simple to add a second tracker to an existing page. I'll show you how below.
I'd like to create a way to see a single GA account for the whole network
The auto-linker plugin actually only works at the property level, so these will not only have to share the same account, but they'll have to share the same property. But this is probably what you want.
I need to be able to track visits and conversions across sites in the network as though they were a single site. Basically, you could think of it as a totally separate, independent GA account for the network.
Exactly, you'll create a brand new property just for this purpose, to track all four of these "sites" as a single "site".
Perhaps there's a way to make GA create two trackers with different cookies, one of which is cross-domain?
You can create multiple trackers running on the same site, but they must share cookies. This is because analytics.js only stores the client ID in the cookie, and obviously the client is the same.
For one of your existing sites that already has analytics installed, the code probably looks something like this:
(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-XXXX-Y', 'auto');
ga('send', 'pageview');
To add another tracker to that page that is tracking a different property, you can just add a few more lines of JavaScript to the snippet. In this example, you're giving your new tracker a the name t2 so it doesn't interfere with the existing tracker.
ga('create' 'UA-YYYY-Z', 'auto', {name: 't2'});
ga('t2.send', 'pageview');
This creates a new tracker and sends a pageview with the new tracker, but it doesn't set up autolinking. To do that you'll have to modify it slightly (assume this code is for domain1.com):
ga('create', 'UA-YYYY-Z', 'auto', {name: 't2', allowLinker': true});
ga('t2.require', 'linker');
ga('t2.linker:autoLink', ['domain2.com']);
ga('t2.send', 'pageview');
And then for domain2.com you'll just have to change the code slightly to autolink to domain1.com:
ga('create', 'UA-YYYY-Z', 'auto', {name: 't2', allowLinker': true});
ga('t2.require', 'linker');
ga('t2.linker:autoLink', ['domain1.com']);
ga('t2.send', 'pageview');
You don't need to list the subdomains because analytics.js tracks those by default.
In addition to the link you provided, here's some more helpful information about cross-domain tracking:
https://support.google.com/analytics/answer/1034342?hl=en

Resources