I am working on a site Local.mensusa.com. which is sob domain of www.mensusa.com.
I added a analytics code to my site but unable to get traffic on my site.
My code:
<script type="text/javascript">
(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-2085156-1', 'auto');
ga('send', 'pageview');
</script>
1: Is this the right code?
2: There is same code pattern for domain and sub domain?
Yes your code looks correct. If you want to be able to compare the data between the Doman and the subdomain then you should use the same tracking code. If you want to keep the data separate ex: two sites that have no relation to each other what so ever, than create a separate account for it.
Possible causes of your problem are.
When did you create the analytics account? it can take 48 - 72 hours for new accounts to begin recording data.
How long ago did you add that code to your site? it can take 24 - 48 hours for new code to start recording data.
Did you check the Real-time report? Standard reports take 24 hours to complete processing.
This tool is also useful for checking that your code is correct. Extension Google Analytics Debugger
It should be the right code. Otherwise, copy/paste it from the dashboard again.
In order to test it, you can easily check if you currently have visitors on your website: go to real time section.
Finally, about subdomain, you have to create another website to watch (with another google code) to track data.
Related
So I've added this additional line of code to our Google Analytics tracking code so it supports display and remarketing campaigns as outlined by this help article https://support.google.com/analytics/answer/2444872?hl=en
However, within analytics, it still keeps showing that it's not been added. It's definitely in there and the rest of the tracking is working fine.
I am using Universal Analytics (analytics.js) and have added that one line to the existing code as shown
(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-53957342-1', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');
Has anyone come across the same issue?
Any tips or advice would be helpful!
Thanks
Activation of this feature may take 48 hours. I recently did the same and added that code to my site and even after click on Validate, it would show as not active until two days later! With most things related to GA, you just need a little patience (usually). If by 48 or 60 hours later the code is still not active, then if you believe you have done everything correctly to implement it, then skip validation.
Hope this helps.
basically, my website is based on one set of html codes but it is hosted on 3 different domains. (example.com, example.sg, example.my)
So each of these websites has their unique ids for Google analytics tracking.
Is there a way to tweak the code from Google to track all three websites respectively?
This is the current code I am using.
<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-38011741-2', 'versafleet.sg');
ga('send', 'pageview');
</script>
It is from here: https://developers.google.com/analytics/devguides/collection/analyticsjs/
The flaw with the code is that it only takes in one id for example.com and there is no where to include the ids for the other 2 websites.
So is there a way to include the ids of the other 2 websites into code to track them as well? Thanks for your help!
You could change your configuration depending on the hostname. Not tested, but it work something like this:
uaids = {
"domain1.com":"UA-XXXXX-X1",
"domain2.sg":"UA-XXXXX-X2",
"domain3.my":"UA-XXXXX-X3",
}
ga('create', uaids[window.location.hostname], window.location.hostname);
ga('send', 'pageview');
where the uaids-Array stores the Account Ids with the respective domain as index and the hostname is pulled via javascript from the location object to retrieve the value.
It would be more reliable to change the account id serverside (but I guess if that where an option you would not have asked).
However in your case it would be simpler to use the same account id for each domain (since apparently the pages are the same) and use view filters based in hostnames to separate the data (update: on second reading I may have misunderstood the requirements).
Unless you expect people to move between the domains and you want to track visitor sessions across domain boundaries - in that case, as already has been pointed out, you would need cross domain tracking (and you should follow Crayons link and get back to us with any problems you encounter there).
Google Analytics uses 1st party cookie tracking. You need to implement cross domain tracking on your pages in order for GA to track the visitor across multiple domains.
My site www.katievb.com is a blog hosted by blogspot.com. I've created a Google Analytics account and registered a "Universal Analytics" property. It provided a unique UA ID and some code to embed in the HTML that looks similar to this:
<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-XXXXXXXX-X', 'katievb.com');
ga('send', 'pageview');
</script>
I did this probably about 24 hours ago. The GA admin page has said "Status: Tracking Not Installed" this whole time. However, GA Real-Time actually does track my visits. (I can use Firefox on a Mac and in real-time see that on the Analytics screen, and then I can go over to a Windows computer with Chrome and visit katievb.com and see that on the real-time screen too.)
In blogspot's settings, I intentionally did NOT populate the Settings > Other > Analytics Web Property ID because it appeared to me that that would expect that I was using the old-style Google Analytics (ga.js) and not this new kind (analytics.js).
Also, I then replicated this in a completely independent pair of blogspot/GA accounts.
Why does it say "Tracking Not Installed"? It seems to be tracking, and I'm not sure what I'm supposed to change about how I installed it.
I've read the instructions many times and have tried different versions of their code and placing it in different locations, such as prior to </head> or </body>.
Eventually it started working. I think it took a day or 2 for the status to accurately reflect that tracking had been properly installed. It's bizarre... because Real-time was working, so I would have guessed that Google's status code would have been able to be updated real-time too.
It takes up to 72 hours to detect, but look in the Reporting section, Standard Reports, under Real Time, and it should show at least 1 active visitors on the site, which is probably you.
You can access to real time tracking.
To see Real-Time data, navigate to the Reporting tab and select Real-Time from the left hand report navigation column.
You will see 1 visitor if there were 1 visitor within the last minute.
My event tracking isnt working on my Google analytic's. Below is the code that it gave me to insert into the webpage and below that is the snippet it told me to put. I am wanting to track the number of clicks onto a 'mailto' link from the website and I believe this is the best way to do it?
Can anyone tell me where its going wrong?
(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-37080107-2', 'promat-durasteel.com');
ga('send', 'pageview');
This is the snippet: (it wont let me put the opening tag on this forum for some reason, but it is there in the coding!
href="mailto:info#sharpfibre.com" onclick="_gaq.push(['_trackPageview, '/Direct-Email-Enquiry-Link-Clicked’]);">info#sharpfibre.com
Please help!
Thanks
As far as I can tell you are mixing two brands of Google Analytics - the new "Universal Analytics" and the , ehm, traditional asynchronous tracking code. Pushing values to the _gaq-Array will not help you since Universal Analytics does not use _gaq (and even if it would you are tracking a (virtual) pageview, not an event).
You'll have to use ga('send') on the click event. Documentation for event tracking with the new GA code is here: https://developers.google.com/analytics/devguides/collection/analyticsjs/events
hopefully someone can help me out.
So l have a google analytics experiment running. However when l set it up and click the "validate code" button l get this error:
No Google Analytics tracking code found.
For both the original, and the variation page.
The thing is, l DO have the google analytics code on the pages.
One thing to note is that my google analytics tracking code looks a little different than most.
It looks like this:
<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-1', 'mysite.com');
ga('send', 'pageview');
ga('require', 'ecommerce', 'ecommerce.js');
</script>
Also it's important to note that the site is tracking visits properly in google analytics.
Can anyone help me out?
When I last checked (yesterday) Universal Analytics did not support (yet) content experiments (although it was announced support would be coming soon). I guess you opened a new GA account - new accounts are now set to Universal Analytics as default, you have to manually switch to the previous asynchronous version. However you cannot change this after you started tracking. IF this is a new account it might be feasible to lose the data already collected and start with a new account that set to the previous version.
Bottom line, you either have to wait with your test until support for content experiment is added or you start again with a new account (or you implement another account parallel to the current one and do your test from there, which to me sounds rather untidy).