0

Somehow I am stuck on this problem and cannot find a working solution:

I have an affiliate website that links to different partner-sites. To track the traffic between the sites we use cookies. However, the cookie is only created when the user visits the partner-site via a special link (with affiliate-ID parameter)

What we need to do:

When someone visits the partner-profile on our website we want to automatically call the partner-website so the cookie is created in the browser. But there should be no automatic popup or similar solution, as we want to maintain a professional look&feel to our website.

Our site is written in PHP/WordPress. What do you consider to be the best solution for this situation/how can this be written in html/php? Preferred solution is one that does not display the partner-website on our site.

(n.b. we need this because we notice that many users visit our website and then use google to find the partner site instead of clicking our link. In this case the affiliate system does not work anymore...)

Philipp
  • 10,240
  • 8
  • 59
  • 71

3 Answers3

3

Make a pixel image using a script on the affiliate that sets a cookie. Include it in the footer using img tags. When the browser requests the image, it will set a cookie. More info on creating a pixel

Community
  • 1
  • 1
tdlive aw'sum
  • 400
  • 1
  • 7
1

You could simply send a POST (or GET) request to your 3rd party website using JavaScript and jQuery:

<script type="text/javascript" >
jQuery(document).ready(function($) {
    var data = {
        foo: 'bar' // if you need to pass parameters
    };
    var targetUrl = 'http://3rdparty.com/cookie-script.php';
    $.post(targetUrl , data, function(response) {
        // do nothing on response
    });
});
</script>

This would allow you to contact the other website in a completely transparent matter for your visitors, without adding unnecessary elements to your page.

Wookai
  • 20,883
  • 16
  • 73
  • 86
0

Though I don't know if I completely understand what you're trying to do, I think you might be able to use an iframe to accomplish what you want.

On your partner-profile page, have a iframe element with the style visibility:hidden or display:none that has a src attribute containing the URL that needs to be visited to set the cookie.

Example:

<iframe src="http://www.example.com?aff_id=12345" style="visibility:hidden;position:absolute"></iframe>

JSFiddle

Joshua Dwire
  • 5,415
  • 5
  • 29
  • 50
  • iframe did not work for all partner-sites, as some have of them use a frame-buster code which did break out and overtake our site – Philipp Aug 05 '13 at 19:43