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
-
Is my tracking code incorrect?
I inherited a website that has a host of issues. I set up Goal Conversions for lead generation and am getting this URL listed as a Goal Completion Location /l/24672/2014-07-31/b4dg5 I can tell it is a date but have no other insight into what or where this page is. Does anyone have experience with this and can offer a fix? A related question is how can I find the URL that triggers the Goal Conversion. I tried editing the goal but it doesn't show the URL anywhere. And the Goal Completion Location is sort of a misnomer because it lists the URL prior to the completion. Thanks!
Reporting & Analytics | | Nobody15969167212220 -
Is Google doing anything about the spam referrer plague in Google Analytics?
My client manages 15+ websites and we have observed the spam referrer issue has gotten steadily worse and worse in the last few months. I took the time to weed out the worst offenders via traffic filters but our referral traffic source garden was quickly full of weeds again a few weeks later. Does anybody know what the Google Analytics development team is doing to combat the spam referrer issue? I find it quite amazing that Google goes through the asinine effort to block out organic keyword data ("not found" & "not provided) but they don't seem to care about blacklisting/filtering spam referrers. RHnE6Wx
Reporting & Analytics | | RosemaryB3 -
Conflicting numbers in Google Analytics
I am getting 2 completely different numbers in Google Analytics.According to the graph on my Dashboard organic traffic decreased ~40% comparing June 7 -> June 6.However, when I dig a bit deeper and look at the 2 dates specifically compared to each other I get a `3% increase in traffic.When I look at the traffic on just June 7, I get the number indicating the increase.Any ideas or someone getting similar conflicting numbers??
Reporting & Analytics | | theLotter0 -
Domain redirect for direct mail (source) tracking in Analytics?
We have a client that would like to do some direct mail marketing and the plan is to use a short/simple domain in the marketing materials, which redirects to the main site domain. By default this would show as a referral traffic source in Analytics, right? So any traffic that came through that redirect would be attributed to "shortdomain.com / referral"? Meaning I wouldn't need to do any sort of customized, advanced tracking set up to track conversions that I've already set up (ecomm and goals) and attribute them to this new source? Just double checking that I'm not overlooking something. Thanks!
Reporting & Analytics | | VTDesignWorks0 -
Google Analytics Goal Tracking Not Working
I am trying to install goal tracking for a client to measure leads from SEO, and I'm running into problems with the Google Analytics goal tracking not working. The only thing that I can think of that is preventing goal tracking from working is that the URL confirming page request URI looks like "contact/#contact-form-4475" and perhaps the hashtag is causing problems. I wanted to ask the community if any of you have run into basic conversion tracking problems like this, where you need to track form fills on a website via a confirmation URL/destination URL goal, and what you did to solve it? I appreciate any input on how to get data on conversions either by fixing the goal in GA or using a different tracking tool. Thanks!
Reporting & Analytics | | williammarlow0 -
Google Analytics Content Experiments
Has anyone else found that Google Analytics Content Experiments seems to quite quickly favor the best performing variant in an experiment, and then show that variant many times more often than other/s - not split the traffic evenly? What is Google's thinking behind 'optimizing' during an experiment? It seems odd to me.
Reporting & Analytics | | David_ODonnell0 -
What impact will Google's 10/18/2011 announcement of 'Making Search More Secure' have on the ability to track specific keyword queries via Analytics?
The full announcement is here: http://googleblog.blogspot.com/2011/10/making-search-more-secure.html My concern is that the ability for Google Analytics to parse information on specific keyword queries will be diminished. The article hints that Google Webmaster Tools will be exempt from the problem, and I've never relied on Webmaster tools as a go-to for tying specific keyword queries to Goal Tracking (form submissions and sales). The community's thoughts on this one are appreciated. 🙂
Reporting & Analytics | | MKR_Agency0 -
Do Google Analytics filters affect link building?
We recently made a few link wheels for specific product pages. We've been having great results with all of the wheels except for one. The one we are having issues with is the only link that we were using a Google Analytics filter on; it looks like this http://domain.com/page.htm?zSource=Specific Keyword%tracking My question is does Google ignore links that are obviously utilizing their analyitcs custom filters? We're doing some more testing to try to find out if it truly is the link or if the wheel is a bad one. There are so many things that could go wrong but with so many of our link wheels working well, I wonder if the filters are what is causing such results.
Reporting & Analytics | | MichealGooden0