Est. Reading Time: 3 minutes
Updating Website to Asynchronous Tracking Code from Traditional Tracking Code Follows Best Practices, Improves Site Performance, and Allows for Greater Flexibility in Code Installation.
Challenge: Client was re-launching website in a new format which offered an opportunity to update the site’s existing traditional Google Analytics snippet to the asynchronous tracking snippet. In addition to staying on the cutting edge with Google’s best practices, this was done to improve site speed and also produce more accurate results. This would also provide Beacon some added flexibility in where the snippet could be placed and still perform at optimal levels.
- Client Facts:
- For Profit Medical & Veterinary School
- Valued at $115M in 2008
- Faculty size greater than 200
- 2000+ Student body hails from 24 countries six continents
- Update website with Asynchronous tracking code for GA for optimal flexibility of code
- Improve site performance in both speed and accuracy with installation
- Installation Notes:
- Tracking code moved into header file for consistency and easier maintenance
- Virtual Pageviews and Events were updated in order to track users who accomplished a predetermined step or goal completion
- Client’s tracking script adhered to Google’s best practices and works at the optimum load time and accuracy levels available through GA
Google’s updates to the asynchronous tracking code offered a greater flexibility than the traditional snippet. When the client re-launched its site to a new Drupal format, this provided a great opportunity to upgrade to the new code which could be placed in a universal header file and still function with a greater accuracy than the previous version. From this point forward, any changes made to the code could be made just once and would be applied site-wide.
Changes to the actual code involved adjusting to the new format. The traditional code used the pageTracker function for its tracking operations. The new async. code is built around the gaq.push function. Once these changes were made to the primary tracking snippet, the final task was to go through the site’s pages and ensure than any virtual pageviews or event tracking were updated to the new codes as well. These represent instances where specialized tracking code snippets are inserted at the point of action to display specific events in Google Analytics. Any instance where this was previously tracked under the traditional snippet was replaced. Beacon was able to conduct a global find and replace to work more efficiently to minimize client hours used.
Results: The adjustments to the asynchronous snippet were made without issue. The client also appreciated that the upgraded tracking code would lead to quicker load times and better accuracy for their Google Analytics data. The new site invested heavily in a number of flash elements, so load time for all installed scripts was critical to ensure a high quality user experience. In terms of accuracy, the client services students hailing from all over the world. Having the most accurate data on segments from each region helps to determine marketing strategy and financing for various countries around the world.