Search code examples
phpgoogle-analyticsanalyticstrackingaffiliate

tracking affiliate links using GA code


I have a very special scenario that I like to discuss here.

My system is based on Affiliate Link Sharing.

There are fixed number of affiliate sharing links (will say, source links). For example:

  http://example.com/affiliate/company1
  http://example.com/affiliate/company5
  http://example.com/affiliate/company3
  http://example.com/affiliate/company2
  http://example.com/affiliate/company4

Now, all of these links redirect to (will say, target link):

  http://example.com/page-1.html

Source links don't exist in reality, and I have rewrite rules on Apache server that redirects any URL having '/affiliate/' to index.php page, where I redirect them to target link

I need to use Google Analytics Code for tracking, but I cannot change/modify contents of target link. How can I achieve tracking


Solution

  • You can redirect to the target with special query parameters: http://www.google.com/support/analyticshelp/bin/answer.py?answer=1033863&topic=1032998

    Target must have the GA code installed.

    UPDATE:

    If the target does not have the GA code installed, you can try:

    • Make the redirect with javascript in index.php and add the GA code on that page.

    OR