Multiple Google Analytics Codes Tracking a Site's Analytics with Two or More GA Codes

Mar 5, 2016

There are times when two separate parties need to track a site’s analytics. Let’s say you’ve just been hired by a new client. Their site has been around for a few years and they’ve had Google Analytics set up with it. Of course, they want to use their analytics code on the new site but you also would like to add your own tracking code as well.

The following code snippet should look fairly familiar if you’ve worked with Google Analytics before. But if you look closer you’ll see the addition of a couple lines of code. They are the two lines that have comments.

Simply add your GA number in place of ‘UA-22222222-1’.

You can also replace ‘secondTracker’ with your own custom name. Just remember to keep it the same on both lines.

This code will allow two entities the ability to track the same web site with Google Analytics.

See the Pen Multiple Google Analytics Codes by Adam (@adambusha) on CodePen.

Adam Bushá