Advertising programs for publishers

 
 
This guide contains information about advertising programs for publishers.







Google Analytics how to track clicks on outbound links



Information
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: http://www.google.com/analytics/

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


Procedure

  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 = "mobilefish.com";

    function mytracker(url) {

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

       // If the outbound link contains the absolute path of your site
       // e.g.: https://www.mobilefish.com/aa/bb.html
       // urchinTracker should not be used.

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

          // If the outbound link contains an external link
          // e.g.: http://www.abcxyz.com:8080/aa/bb.html?val=10
          // the path=/external_link/www.abcxyz.com:8080/aa/bb.html?val=10.

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




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

    <html>
    <head>
       <title>demo</title>
       <script type="text/javascript" language="JavaScript" src="/analytics.js">
       </script>
    </head>
    <body>
    :
    :
    <a href="http://www.abcxyz.com:8080/aa/bb.html?val=10" onclick="javascript:mytracker(this.href);">Click here.</a>
    :
    :
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    if(googleAnalytics){
       _uacct="
    your_account ";
       urchinTracker();
    }
    </script>


    </body>
    </html>

    Explanation:

    • 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.