Installing Google Analytics tracking code on Landing Pages
-
Hello,
I have my landing pages located on a separated subdomain (LP.example.com).
I've created a new property in Google Analytics for that subdomain. My question is:
- where do I have to place the GA tracking code ? in the header ? before I close the tag or before I close the tag ?
I have another issue: I've placed the GA Tracking code on some pages in the way below:
in the body tag of that Landing page HTML Code I added this line: -
Hi Joni, thanks for your question! You've received some great replies! Did any of them answer your question? We'd love an update, thanks.
Christy
-
Hi Folks,
My apologies the recommendation only applies to Google Tag Manager (GTM)
https://developers.google.com/tag-manager/quickstart
I would never recommend anyone to use just GA/UA with scripts unless they are a developer and even if they are they should recognise the advantage of using GTM. With GTM there is no need for putting GA/UA scripts directly on the page/site unless its eCommerce or something very cutsom. Anywho thats my two cents, I hope Joni got sorted.
Dave
-
I agree stick with what Google says keep it in the header
- Paste your snippet (unaltered, in it’s entirety) into every web page you want to track. Paste it immediately before the closing tag.
If your website uses templates to generate pages, enter it just before the closing tag in the file that contains the the section.
- Paste your snippet (unaltered, in it’s entirety) into every web page you want to track. Paste it immediately before the closing tag.
-
Hi!
I'm sorry to disagree with you Dave, but actually, in most cases you need to place your analytics script just before the tag to be more accurate.
You can see the set up for GA tracking code in Analytics Help: https://support.google.com/analytics/answer/1008080?hl=en.
Also, if you want more background information, here the guys from Luna Metric have written an excellent article that details where to put the GA snippet and why.
Hope it helps!
-
Hi Joni,
The GA tag ALWAYS goes just inside of your opening body tag () and it differs again for eCommerce with the page needing to be loaded before events are reported to GA. Try the search terms "ga tag body" and you will get a few links that will make it crystal clear where it goes.
I would also strongly advise you to look at using Google Tag Manager (GTM) over a standard analytics setup especially if you don't have a development background.
I wouldn't be overly concerned with Wappalyzer not seeing the GA code but its not a good sign. I would recommend using the Google Analytics debugger for Chrome/Firefox to do any debugging of GA tags.
Dave
-
You want to place the regular Google analytics JavaScript in right above the body tag.
If it is the new universal Google analytics I believe it must be in the head to work properly. However when you are actually copying the code they give you a you can read the directions and then what I suggest doing is going over whatever part of the site they reference for instance if it states this tag must be in between the
<header>and <header>tags copy the tag, then use the command + F on a Mac or control +F on a PC in order to find the tag that they suggest you place it above or under. It will either be in the header or above the body tag.
Hope this helps,
Thomas</header> </header>
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Track PDF's in Google Analytics
Hi Mozzers, Is it possible to track PDF's via Google Analytics/Google tag manager? I'm not only looking for PDF downloads but for the actual activity when someone opens an interactive PDF document. So would it be possible to have onclick events on buttons in the PDF etc... Many thanks!
Reporting & Analytics | | WeAreDigital_BE
Sander0 -
We have a client that wants to apply UTM URL tagging to track local organic traffic in Google Analytics. Is there any benefit in doing this?
One of our clients requested that we apply UTM URL tagging to better track organic traffic in Google Analytics. We found this to be an odd request because we are most familiar with UTM tracking for special campaigns (referral tracking, PPC, email tracking, etc). Is there any benefit of applying UTM tags to urls to analyze local organic traffic in Google Analytics? Are there any resources out there about this? Thanks!
Reporting & Analytics | | RosemaryB0 -
Is there a way to find out who the admin of a Google Analytics account is?
We have a client who has been searching high and low to gain access to the GA account that is tied to their website, but previous agencies keep stating they don't have access. Is there a way to find out who the admins are on a GA account with the tracking number so we can reach out to that person and ask them to admin the client?
Reporting & Analytics | | marketingmediamanagement0 -
Google Shopping tracking as organic traffic - help!
Hey guys, I have an eCommerce client who sometimes runs Google PLA and Google Shopping campaigns. However, we don't run his AdWords for him, just do his SEO. At the moment, the Shopping campaigns track as organic traffic within Analytics. And I can't see any way to change this! It's so infuriating. How do I change this? Thanks!
Reporting & Analytics | | jasarrow0 -
Ga event tracking and GAC code placement
Just relaunched website and since then specific event tracking has zeroed. I copied event tracking directly from old site so it should work. Overall analytics are fine. Only variable I can think of is where google analytics code is placed. Does GAC code need to be on HTML header or at end of body specifically for event tracking to work? Example: Steripen.com/freedom/... When user clicks "REI" icon, this tracks an event that a user clicked on one of our"retailer links." Any feedback is greatly appreciated.
Reporting & Analytics | | Timmmmy0 -
Cover my tracks / two websites on the same Analytics
Hi, I've got 2 websites and I like one of them to make some links to the other one. These two sites are on the same Google Analytics account. They have been set up 3 month ago and they have some articles on them. I've heard that Google can see that those websites are related in my Analytics and use this information to give less power to the link I could make between them. What do think about it and what do you recommend me ? Shoud I closed the Analytics account ? Or down one of the website and rebuilt it whith a different domain / host / analytics ? The thing is if I delete one of the website i'll be force to republish the articles, because there are links on it, and they're part of a deal I've already made. Thank you
Reporting & Analytics | | Spleen0 -
Regular Expressions in Google Analytics
I want to use the Google Analytics landing page reports to look at the bounce rate of top level pages excluding the homepage. So pages with urls: www.example.com/example Does anyone know a regular expression that will allow me to do this? Just to clarify I do not want to look at the bounce rate of the homepage or any pages deeper than www.example.com/example e.g: www.example.com/example/example www.example.com/example/example/example etc Thanks in advance
Reporting & Analytics | | CPLDistribution0 -
Google Analytics Options
A couple of months ago, I read about a new web stats application that is real time but more importantly let's you track user actions on a page (i.e. which buttons were clicked for example). This information would obviously be very helpful in continuing to improve site performance. Anyone have suggestions or know the name of this application? I do not mind paying but am not looking for an enterprise class application.
Reporting & Analytics | | Mont0