Offsite Link Tracking

From Boston Magazine Wiki
Jump to: navigation, search

Offsite Link Tracking (This only applies to links that go to other websites or non CMS files like PDFs!)

If you are adding links in to text that anywhere on the site please follow these procedures. This only applies to TextAreas or WYSIWYG form fields. If you type in a link in to any of these types of fields and the link is to a page or site not on the Boston or Philly sites we would like to start tracking these “offsite” clicks if possible. We can do that if you add something to the HREF….

A normal HREF tag looks like this:

<a href="URL-GOES-HERE">link</a>

This is what you'll need to add to your HREF tag:
onclick="javascript:pageTracker._trackPageview('/outgoing/URL-GOES-HERE');"

You will simply need to replace the URL-GOES-HERE with the URL that you’re linking to. But do not add the "http://". For Example:
Correct: onclick="javascript:pageTracker._trackPageview('/outgoing/www.google.com');"
Not Correct: onclick="javascript:pageTracker._trackPageview('/outgoing/http://www.google.com');"

So your new HREF tags will look like this:

<a href="URL-GOES-HERE" onclick="javascript:pageTracker._trackPageview('/outgoing/URL-GOES-HERE');">link</a>

Again… This is only necessary if you want to track the number of clicks that will go to offsite links.

Personal tools