Mobile app version of vmapp.org
Login or Join
Pierce454

: Redirect to an affiliate using PHP or JavaScript redirect? I was asked to introduce a unified self hosted URL-Shortener/Forwarder/Tracking Service for an website that earns money from affiliates.

@Pierce454

Posted in: #Affiliate #HttpHeaders #Javascript #Php #Redirects

I was asked to introduce a unified self hosted URL-Shortener/Forwarder/Tracking Service for an website that earns money from affiliates. One example I found was one of the bigger german sites for bargains. (mydealz)

So I had a look at their way of doing it, and I was quite surprised.

From my point of view, the only sensible way to do the forwarding and tracking is using a PHP header redirect, if 301 or 302 in my eyes is mainly a question wether you want to double track double links or not.

But they do the forward using a small page using javascript window.location.href. But why?



Is there any advantage that I don't see? Are there any disadvantages of the PHP redirect?

As far I as tested no referer are lost while using header redirect.

Thanks in advance for your help.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Pierce454

2 Comments

Sorted by latest first Latest Oldest Best

 

@Pierce454

I just found the solution myself. There is no way to modify the referer using PHP, as this is being sent by the browser. The script I posted above is basically the same script, just without Step 1, posted by @honyovk on Stackoverflow in this topic. stackoverflow.com/questions/6428762/hide-referrer-on-click/11249553#11249553
And probably the idea is to make sure that if someone shares the link, it still sets the correct referrer to ensure that an affiliate network relying on refferer still tracks the sale/lead/click to the right account.

10% popularity Vote Up Vote Down


 

@Angela700

I always lean towards a server side redirect for this sort of thing as well. The only possible disadvantage I could see (though I don't consider it one) is that by using server side 301's your affiliate links aren't likely to get indexed in Google. If you don't care about getting your redirect links indexed then it seems to me that a server side redirect is much more reliable and makes a lot more sense in the case you presented.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme