Setting Up Asynchronous Google Analytics Tracking
Posted on January 26, 2010
Google Analytics, Google Updates, Web Analytics |
Google launches asynchronous tracking as an alternative google analysis tracking tool to help website owners track their site visitors. The Google Analytics Asynchronous Tracking Code snippet is a small piece of JavaScript code that website owners paste into their web pages. It activates Google Analytics tracking by inserting ga.js into the page which then provides an API for customizing how the page is tracked.
Google explains that there are a number of advantages to using Asynchronous tracking that include: ‘allows for much quicker tracking code load times as a result of the improved browser execution, optimizes how browsers load ga.js, eliminates tracking errors from dependencies when the JavaScript hasn’t fully loaded, and improves data collection and accuracy.’
The below snippet displays the minimum configuration required to track a page asynchronously. It denotes the page’s web property ID and then calls ’trackPageview’ to send the tracking data back to the Google Analytics servers. The best location for the google analytics tracking snippet is at the top of the <body> section. To set up asynchronous tracking, you just have to copy and paste the following snippet replacing UA-XXXXX-X with your web property ID:
<script type=”text/javascript”>
var _gaq = _gaq || [];
_gaq.push([’_setAccount’, ‘UA-XXXXX-X’]);
_gaq.push([’_trackPageview’]);
(function() {
var ga = document.createElement(’script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (’https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
(document.getElementsByTagName(’head’)[0] || document.getElementsByTagName(’body’)[0]).appendChild(ga);
})();
</script>
If you want to add the asynchronous snippet on pages that do not use Google Analytics or are currently using traditional tracking with ga.js, Google shows how you can convert your pages to use the asynchronous snippet by doing the following:
1. If the page already uses Analytics, remove your existing tracking code snippet and any customizations you have made.
2. Insert the asynchronous snippet at the top of the <body> section of your pages.
3. Modify the _setAccount method with your web property ID.
4. Add your customizations back in using the asynchronous syntax.
If you would rather place the Analytics snippet at the bottom of the page, you can still keep most of the benefits of asynchronous loading by splitting the snippet in half. You have to keep the first half at the top of the page and the other half at the bottom of the page. You will have to place the snippet that inserts ga.js at the bottom of the page. For more detailed information about setting up asynchronous analytics tracking and answers to common installation questions, Google Analytics provides a helpful guide on their Google code web pages.
Comments
Leave a Comment
If you would like to make a comment, please fill out the form below.
You must be logged in to post a comment.
Toronto Marketing Posts
- Benefits of Google Website Optimizer
- What To Look For When Outsourcing Web Development
- Importing Blog Content to your Facebook Page
- How to Lower Your Cost Per Acquisition
- Google AdWords Management
- Setting Up Asynchronous Google Analytics Tracking
- Breadcrumbs in Google Gain More Links
- Search Engine Optimization Proposals
- Guaranteed Number One Spot on Google Scam
- Toronto Google Analytics Consulting
Categories
- Affiliate Marketing Tips
- Affiliate Themes
- Article Marketing
- Bing.com
- business blogging
- Google Ad Words
- Google AdWords
- Google Analytics
- Google Quality Score
- Google Updates
- Google Website Optimizer
- Key Word Research Tools
- Keyword Tool Review
- Landing Page Optimization
- Link Developmet
- Link Tactics
- Linkwheels
- meta tag strategy
- Pay Per Click
- PPC Keyword Tools
- Ranking reports
- Search Engine Optimization
- SEO Bing
- Social Media Marketing
- Toronto Marketing Consultant
- Toronto Online Consulting
- Toronto SEM Consulting
- Toronto SEO
- Toronto SEO Consulting
- Toronto Web Consulting
- Web Analytics
- Web Development
- Web Directories
Archives
- March 2010
- February 2010
- January 2010
- November 2009
- October 2009
- September 2009
- August 2009
- June 2009
- May 2009
- March 2008