Search code examples
.htaccesshttp-redirecthyperlinkgoogle-analyticsaffiliate

Using .htaccess to redirect my affiliate link and track in Google Analytics


Helo all,

I'm a novice affiliate marketer, but I'm already making web hosting sales by placing my affiliate link in a number of places. I'd like to do the following:

  1. Mask my affiliate link using my main domain name i.e. www.mydomain.com/affiliate-link

  2. Track the re-direct using Google Analytics.

I've tried creating the directory "affiliate-link" on my server with the following .htaccess code:

RewriteEngine On
RewriteRule ^$ http://my.affiliate-link.com/aff.php?1234&utm_source=Name&utm_medium= referral-link&utm_campaign=hosting-affiliate

I used Google's url builder to generate the code. The redirect works when I go "www.mydomain.com/affiliate-link", but Google analytics isn't showing any data. Am I doing something wrong? I'm assuming I need to add the campaign I've created via the link builder to Google Analytics?

Thanks!


Solution

  • You are sending traffic to my.affiliate-link.com, so it will show up in the analytics for that website.

    You are exiting when you click on www.mydomain.com/affiliate-link, so analytics will not get a chance to fire again. Your affiliate will get the source details added at their end.

    You would be better off getting a GA expert to answer this, but you would be best to track clicks with event tracking code, I assume.