Case Study: Medical School Uses Google’s Async Code to Provide Accurate and Flexible Tracking

By | 2017-06-16T12:44:43+00:00 July 14th, 2015|Categories: Case Studies|Tags: , |

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
  • Goals:
  • 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
  • Results:
  • Client’s tracking script adhered to Google’s best practices and works at the optimum load time and accuracy levels available through GA


Business Solution: Previously the Google Analytics tracking code for the client’s website was located before the closing <body> tag towards the end of the page. This was considered an ideal location for this JavaScript snippet because it gave the page an opportunity to load prior to firing. However, due to the structure of the client’s website, this involved the code being included in a number of template files in order to be consistently rendered across every page. Any update to the code required changes to all of these files which increased the potential for errors.

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.

About the Author:

Logan Ray
Logan is an accomplished marketing professional with nearly a decade of experience. As a Digital Marketing Strategist at Beacon, he heads our SEO team and drives Google Analytics strategy for higher education clients like Colorado State University Pueblo and California State University East Bay. A recognized SEO expert, Logan leads SEO workshop sessions at industry conferences and presents strategy and tactics to graduate students in the Wake Forest University BSBA program. Logan is Google Analytics-certified and holds a B.S. in Marketing from the University of North Carolina at Greensboro.