Switching from synchronous to asynchronous code in GA
-
Morning all,
I'm looking to integrate GA with Webmasters tools but to do so I need to have the new asynchronous GA code implemented into my website.
Now, I'm happy to just copy and paste the new code into my site footer, but will that any effect on the data that I've already tracked? Is there any reason why this is really not a good idea?
Thanks for your help,
-
You'll probably notice your site loads a bit faster with asynchronous. With synchronous, the GA code is loaded with everything else on the page (like images CSS files, etc). If the GA script is slow in loading (which can happen from time to time) then the client browser is going to be left hanging there until it's fully loaded (as in the swirling "Working" icon is still there, even if everything else is loaded). Worse, if you have JS that waits until the page is fully loaded to do something important, it's now stuck waiting on that as well.
Asynchronous means that the client doesn't have to wait until that library is loaded. The GA stuff now happens in the background. This is why HTML5 has an async attribute.
As to data already stored, there would be no effect. The asynchronous scripts do the exact same thing as their synchronous counterparts.
-
Good afternoon (GMT+1 time ;-)),
The data you have already tracked in your Google Analytics will still be available after switching to the new asynchronous code. As far as I now there are no reasons why switching would be a bad idea. Because loading you're Web site even faster would already solve your problems.
Hope this helps!
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
-
New website server code errors
I launched a new website at www.cheaptubes.com and have recovered my search engine rankings as well after penguin & panda devestation. I'm continuing to improve the site but moz analytics is saying I have 288 medium issues and i see the warning "45% of site pages served 302 redirects during the last crawl". I'm not sure how to fix this. I'm on WP using Yoast SEO so all the 301's I did are 301's not 302's. I do have SSL, could it be Http vs Https?
Reporting & Analytics | | cheaptubes0 -
ECommerce Tracking Code Installation
Hi All, Kindly explain how to implement eCommerce tracking code on the website.I am aware how to enable and generate eCommerce tracking code in Google Analytics but have confusion from website end.Also, where i read the steps, everywhere i read the below code: <script< span="">type="text/javascript"> var _gaq = _gaq ||[]; _gaq.push(['_setAccount','UA-XXXXX-X']); _gaq.push(['_trackPageview']); _gaq.push(['_addTrans', '1234', // transaction ID - required 'Acme Clothing', // affiliation or store name '11.99', // total - required '1.29', // tax '5', // shipping 'San Jose', // city 'California', // state or province 'USA' // country ]); // add item might be called for every item in the shopping cart // where your ecommerce engine loops through each item in the cart and // prints out _addItem for each _gaq.push(['_addItem', '1234', // transaction ID - required 'DD44', // SKU/code - required 'T-Shirt', // product name 'Green Medium', // category or variation '11.99', // unit price - required '1' // quantity - required ]); _gaq.push(['_trackTrans']);//submits transaction to the Analytics servers (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'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); ----------------------------------------</script<> In the above code specific transaction id, SKU/code are mentioned. What will be the modifications in the above code if i have to track all products present on my eCommerce website??
Reporting & Analytics | | RuchiPardal1 -
Show item status in GA - LIve vs sold vs unsold
Hi guys, I am working with SEO for an auction site with B2C and C2C. (similar to eBay) All item\products on our page have an unique url. The auction can last from hours to weeks.
Reporting & Analytics | | helgeolaussen
When the item is live, sold or (finished but)unsold it still has the same url.
So when I take a look at SEO traffic to items in Google Analytics, I can't tell if the item was live, sold or unsold at the time the user landed on the page. Which makes it diffucult to analyse the traffic. Is there anyway I can make GA show the status of the item for the time user landed on it? Best regards, Ceran0 -
A switch from Search to Direct traffic from Feb 2012
I have read about the Google algorithm updates galore in 2012. I would therefore be inclined to suspect a sudden sharp drop in Search traffic this year to be caused by such updates. However, I am seeing what appears to be a direct switch from 'Search' to 'Direct' traffic as of about February 16th this year. There are no specific brand-building exercises or general advertising campaigns happening around this time for the site in question. It seems very UN-explainable? I wondered if there are any thoughts from the various lurking gurus? I have attached GA screenshot.. DjTu1.png
Reporting & Analytics | | MikiP0 -
Switching Google Analytics from Urchin to GA
I want to finally make the switch from Urchin to GA in Analytics, but the Google support page is no longer working (I realize I'm late to this so they likely took it down/moved it to where I can't find it). I've been searching on Google but can't find a straightforward guide to changing that won't disrupt my data. Anyone have a link to a working guide, or can you provide some guidance?
Reporting & Analytics | | Axios_Systems0 -
Multipul Analytics codes usage
I need to launch 13 local websites and need to have two analytics codes on each site, one is unique for each site and the other is the same across all sites. any advice on how this is best done?
Reporting & Analytics | | imsmlouis0 -
How to export all my keywords from GA new version
Hi I want to know how can i download all my keywords within the kw report of the google analytics new version. It seems to me that the "limit=50000" parameter doesn't work on this new version. If that is true how can i do to export all my keywords let say on CSV format? Thanks a lot
Reporting & Analytics | | FranckNlemba0 -
GA - how returning visitors are counted ?
If a visitor comes to my site from 3 different traffic sources within a session, does GA report shows 1 visit and 2 returning visitors ? Previously ( before Google made changes in session ) it used to show 1 visit and zero returning visitors. right ?
Reporting & Analytics | | seoug_20050