Advertising programs for publishers

This guide contains information about advertising programs for publishers.

rss feed

Google Analytics how to track clicks on outbound links

Google Analytics (previously called Urchin) is a web based analytics tool to analyze the flow of visitors through your site. This tool is free as long as the site has less than 5 million pageviews a month. Users with an active Google AdWords account are given unlimited pageview tracking.

More information about Google Analytics can be found at:

To implement Google Analytics on your site you need to implement a tracking code into each of your website pages.


  1. Usually outbound (also known as external) links begins with:

    <a href="http://...>nnn</a>

    and inbound links uses relative paths, thus the links looks like:

    < a href="../../...>nnn</a>

    Put the following code in a javascript file, e.g.: analytics.js.

    // On your development environment set googleAnalytics on false.
    var googleAnalytics = true;

    // Set you site domain here.
    var mydomain = "";

    function mytracker(url) {

       startVal1 = url.indexOf(mydomain);
       startVal2 = url.lastIndexOf("://");

       // If the outbound link contains the absolute path of your site
       // e.g.:
       // urchinTracker should not be used.

       if (!(startVal1 >0) && (startVal2 >0) && googleAnalytics) {

          // If the outbound link contains an external link
          // e.g.:
          // the path=/external_link/

          url = url.substring(startVal2+3, url.length);
          path = "/external_link/" + url;

  2. In your html code, add the following lines:

       <script type="text/javascript" language="JavaScript" src="/analytics.js">
    <a href="" onclick="javascript:mytracker(this.href);">Click here.</a>
    <script src="" type="text/javascript">
    <script type="text/javascript">
    your_account ";



    • googleAnalytics = true;

      Enable or disable the usage of urchinTracker.
      On your development environment you should set it to false.

    • function mytracker(url)

      The mytracker function creates the path as input for urchinTracker function.
      You can change the code to suit your needs.

  3. To view all external links, log into Google analytics.

  4. Select menu: Content Optimization | Top Content

  5. In the filter textbox, enter: /external_link

    Google Analytics filter

  6. An overview of all external links will be shown.