| Webtraffic Exchange | Digital Marketing

Install UTM Tracking Code

The UTM (Urchin Traffic Monitor) tracking code is used to track traffic source, medium, and campaign; and allows businesses to track conversion funnel from referral site. With the introduction of Google Tag Manager, some folks are unclear how to implement UTM tracking codes into their HTML pages. The following two simple steps will guide you through installing the UTM javascript snippets into your web pages.

1. Add the classic Google Analytics library, ga.js from Google CDN.

<script src="//www.google-analytics.com/ga.js"></script>

2. Login to your Google Analytics account, and get your GA code snippet.

<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';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

Add ga.js and your Analytics tracking code at the bottom of your HTML page just before the closing </body> tag.

Note: The ga.js is an old classic Google Analytics library, which is different than the newer Universal Analytics (analytics.js). Including the ga.js on your page will not create UTM cookies, but including the latter GA code snippet (particularly ga('create', 'UA-XXXXX-Y', 'auto');)will cause it to create the UTM cookies in client's computer.

Share this Post: Facebook X LinkedIn Email


0 Comments

Comments are moderated to keep the discussion useful and respectful. Spam, automated submissions, and low-value promotional comments are removed.

  • No comments have been published yet.

Leave a Comment

Related Articles