Google Analytics Set Up - google-analytics

I am brand new to the small business I'm working at and I suggested we implement Google Analytics on our website to help track traffic flow.
Well, I am not exactly computer tech savy and am having a difficult time know how to link the Tracking ID to our web pages. Am I really supposed to edit the code on every web page I'd like to track? If so, how does one even "edit code".
Thanks for the insight,
Dana

yes, the code does need to be on every page that you want to track - there should be a code like this which you get from your admin section:
<!-- Google Analytics -->
<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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
This needs to be on every page. In answer to how to "edit code", it depends on your website. It is probably easiest to just send your code snippet to whoever built the website and ask them to place it in the head of every page - they will have an easy way to do it via a content management system or tag management system.

Related

Google Analytics page view tracking

I am using a shiny dashboard with about 20 pages and recently implemented Google Analytics to track page views. The number of pageviews in GA seems to be the same for all pages. I think that once the home page is hit, all other pages are getting hit as well.
I need help to solve this problem. My GA.js script contains the auto script generated while creating an account with GA and this script.
ga('send', 'pageview', {'title': 'Shiny Dashboard','page': '/#shiny-tab-dashboard'});
I have generated similar lines for all the pages with different 'title' and 'page'. Thanks for helping out.
Google analytics does not record hash parameters by default so you would have to a
change your tracking code
https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#allowAnchor
Below are the changes required
Replace
ga('create', 'UA-XXXXX-Y', 'auto');
with
ga('create', 'UA-XXXX-Y', {'cookieDomain':'auto','allowAnchor': false});

Google Analytics not tracking data

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.

How to view individual page tracking results in Google Analytics

View page tracking results
I have added the Google tracking JS code to each page in my site:
(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-x', 'auto');
ga('send', 'pageview', '/virtuvalPath/myPageName');
I am getting results from Google Analytics, but the results are summarized for all pages. I want to see the page views for each specific page. How can I view the results for each individual page within Google Analytics?
Thanks.
You can either
Click into each individual page link in the All Pages report, or
Add an advanced filter to filter only for your specific page, or
Create a custom report with the specific page
There are probably other methods but these should be the most direct.

What steps do I take to access my site's visitor demographics via google analytics?

I am making a website for an author who recently finished writing a book. I want to track the demographics of visitors to a site. I have heard Google knows an visitor's gender and country as well as age (at least approximately).
My employer (the author) and I would like to track which visitors purchase books and therefore who to target with a marketing campaign in the future. What steps do I take to access this data? Is it even possible?
First, update your tracker
Now it should looks like:
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
And you need this:
ga('create', 'UA-XXXXX-Y', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');
Enable demographic reports in administration
In Google Analytics select the Admin tab -> Property -> Demographic and Interests data.
In the PROPERTY column, click Property Settings -> Advertising Features -> set Enable Demographics and Interests Reports to ON.
-> Save.
Documentation
Tech: https://developers.google.com/analytics/devguides/collection/analyticsjs/display-features
Admin: https://support.google.com/analytics/answer/2819948?hl=en

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