1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How To Track Affiliate Links in Analytics

Discussion in 'White Hat SEO' started by Pvlman, Oct 22, 2014.

  1. Pvlman

    Pvlman Regular Member

    Joined:
    Mar 19, 2013
    Messages:
    223
    Likes Received:
    51
    Hi,

    I am using affiliate links that look like "www.mydomain.com/redirect/affiliatecompany/". This subfolder contains a simple index.html file that has this code inside:

    Code:
    [TABLE]
    [TR]
    [TD="class: line-content"]<html>[/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]    <head>[/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]        <meta name="robots" content="noindex" />[/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]        <meta name="robots" content="noarchive" />[/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]        <meta name="robots" content="nofollow" />        [/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]        <script type="text/javascript">        [/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]            setTimeout("location.replace('afflink');", 50);[/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]        </script>[/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]                [/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]    </head>[/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]    <body>        [/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]        [/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]    </body>[/TD]
    [/TR]
    [TR]
    [TD="class: line-number"][/TD]
    [TD="class: line-content"]</html>[/TD]
    [/TR]
    [/TABLE]
    
    
    It all works swell and redirects fine, but how can I track clicks through Analytics -> Events? I don't want to use the onClick=trackEvent function since I use these link redirects across the whole site and it would be too much of a hassle to add it in front of every link.

    Is there a way how to make it easier? Like putting the event tracking code INSIDE the index.html?

    BTW I am using Wordpress.

    Thanks