Passing Affiliate Variables and Redirect User

Hi,

I am not sure if this is the correct forum, so if it isn’t please move it to the appropriate one.

I have a Wordpress site and I have referral links to a site called TheDailySave. They gave me the referral link: http://www.thedailysave.com/x/a474s2c484 and it works fine.

The problem is it takes users to the default homepage and I want to be able to direct them to individual deals. The links below are direct links for the 5 different deals TheDailySave.com offers each day around San Diego.

http://thedailysave.com/north-county-coastal
http://thedailysave.com/north-county-inland
http://thedailysave.com/metro
http://thedailysave.com/east-county
http://thedailysave.com/south-bay

I have found a website that is doing what I want, but it is not a Wordpress site so I am not exactly sure how to do it myself with Wordpress.

The site I am referring to is: http://groupbuydaily.com/San-Diego. They have the one TheDailyDeal link in the top section and links to the other 4 deals in the bottom section.

Below is a snippet of code of how they do it…

                                                                                                                                                                           markerCoords = markerCoords.concat([new google.maps.LatLng(32.7484637, -117.1290809)]);
markerTitles = markerTitles.concat(['$12 for $25 in Thai Cuisine at Street Side Thai Kitchen']);
markerImages = markerImages.concat(['/images/red_MarkerA.png']);
infoContents = infoContents.concat(['<b><a href="#" onclick="loadDealPage(this,\\'dailysave\\',\\'http://thedailysave.com/x/6454q29414/\\',\\'http://thedailysave.com/metro\\')" class="dealoffer1">$12 for $25 in Thai Cuisine at Street Side Thai Kitchen<\\/a><a href="#" onclick="loadDealPage(this,\\'dailysave\\',\\'http://thedailysave.com/x/6454q29414/\\',\\'http://thedailysave.com/metro\\')"  class="getdeal1">Get Deal<\\/a>Street Side Thai Kitchen<\\/b><br/> 3025 University Ave San Diego, CA 92104 (619) 228-9208']);

My goal is to list the 5 links on my site using my 1 referral link and when someone clicks on that link… they will be taken to the correct page.

Anybody know how to accomplish that using Wordpress?

Thanks in advance…

Doug

Wow… I thought someone here would know the answer to this one :frowning:

Does anyone know how to make it work not using Wordpress maybe? How about using the code displayed in my post above? I am not sure what script I would need to use to make that code work.

Anybody have a suggestion?

Thanks,

Doug

The problem is, Wordpress aside, is that once you redirect them to your referral link they are at the whim of TheDailySave.

Maybe TheDailySave website has some additional parameters you can send along with your referral link?

Hi Anthony,

Thank you for responding. I did speak to TheDailySave and they did not have a solution…

I know it is possible, as these guys: http://groupbuydaily.com/San-Diego are doing it.

They are doing it with the code below, but I am not sure what additional code it needs to make it work?

<h3><a href=“#” onclick=“loadDealPage(this,‘dailysave’,‘http://thedailysave.com/x/6454q29414/','http://thedailysave.com/metro’);” class=“getdeal”>Get Deal</a></h3>
See it shows the affiliate URL: http://thedailysave.com/x/6454q29414/

and then next to it it has the URL they want the user to actual go to:
http://thedailysave.com/metro

then farther down the page they have links to
http://thedailysave.com/north-county-coastal
http://thedailysave.com/north-county-inland
http://thedailysave.com/east-county
http://thedailysave.com/south-bay

Unfortunately, I never went to programming school… so I have no idea how the code above works, but I was hoping someone here might?

Anybody have an idea or suggestion?

Thanks again,

Doug

Here’s the JavaScript function they use:


function loadDealPage(obj, targetname, reflink, deallink){
    recordOutboundLink(obj, "sandiego", targetname)
    obj.target = targetname;
    obj.href = reflink;
    setTimeout(function(){
        window.open(deallink, targetname)
    }, 750);
}

Which they call with:


loadDealPage(this,'dailysave','http://thedailysave.com/x/6454q29414/','http://thedailysave.com/metro')

The code changes the target of the link, then opens a new window to the affiliate URL.

Here’s a quick demonstration…

http://dev.anthonysterling.com/sp/

Here’s the code too…


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" media="screen" href="http://yui.yahooapis.com/3.3.0/build/cssreset/reset-min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="http://yui.yahooapis.com/3.3.0/build/cssbase/base-min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="http://yui.yahooapis.com/3.3.0/build/cssfonts/fonts-min.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
    <style type="text/css">
    </style>
    <title>
      SitePoint - Demo
    </title>
  </head>
  <body>
    <a class="daily-save" href="http://www.google.co.uk/">A</a>
    <a class="daily-save" href="http://www.google.co.uk/">B</a>
    <a class="daily-save" href="http://www.google.co.uk/">C</a>
    <a class="daily-save" href="http://www.google.co.uk/">D</a>
    <a class="daily-save" href="http://www.google.co.uk/">E</a>
    <a class="daily-save" href="http://www.google.co.uk/">F</a>
    <a class="daily-save" href="http://www.google.co.uk/">G</a>
    <a class="daily-save" href="http://www.google.co.uk/">H</a>
    <a class="daily-save" href="http://www.google.co.uk/">I</a>
    <a class="daily-save" href="http://www.google.co.uk/">J</a>
    <a class="daily-save" href="http://www.google.co.uk/">K</a>
    <a class="daily-save" href="http://www.google.co.uk/">L</a>
    <a class="daily-save" href="http://www.google.co.uk/">M</a>
    <a class="daily-save" href="http://www.google.co.uk/">N</a>
    <a class="daily-save" href="http://www.google.co.uk/">O</a>
    <a class="daily-save" href="http://www.google.co.uk/">P</a>
    <a class="daily-save" href="http://www.google.co.uk/">Q</a>
    <a class="daily-save" href="http://www.google.co.uk/">R</a>
    <a class="daily-save" href="http://www.google.co.uk/">S</a>
    <a class="daily-save" href="http://www.google.co.uk/">T</a>
    <a class="daily-save" href="http://www.google.co.uk/">U</a>
    <a class="daily-save" href="http://www.google.co.uk/">V</a>
    <a class="daily-save" href="http://www.google.co.uk/">W</a>
    <a class="daily-save" href="http://www.google.co.uk/">X</a>
    <a class="daily-save" href="http://www.google.co.uk/">Y</a>
    <a class="daily-save" href="http://www.google.co.uk/">Z</a>
    <script type="text/javascript">
      $('a.daily-save').click(function(){
        setTimeout(function(){
          window.open('http://thedailysave.com/x/6454q29414/');
        }, 750);
      });
    </script>
  </body>
</html>

Anthony,

You are my super HERO dude! Thank-you so much… I really appreciate it!!!

To be clear… all I need to do is change the url’s to the page I want to go to and the affiliate variables should pass through as well?


<a class="daily-save" href="http://thedailysave.com/north-county-coastal/">A</a>
<a class="daily-save" href="http://thedailysave.com/east-county">B</a>
<a class="daily-save" href="http://thedailysave.com/metro">C</a>

Do I need the stuff in <head> section too, or just the java script?

Thanks again,

Doug

Thank you, you’re most welcome. :slight_smile:

Technically, you just need this:-


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
    <title>
      SitePoint - Demo
    </title>
  </head>
  <body>
    <a class="daily-save" href="http://www.google.co.uk/">A</a>
    <a class="daily-save" href="http://www.google.co.uk/">B</a>
    <a class="daily-save" href="http://www.google.co.uk/">C</a>
    <a class="daily-save" href="http://www.google.co.uk/">D</a>
    <a class="daily-save" href="http://www.google.co.uk/">E</a>
    <script type="text/javascript">
      $('a.daily-save').click(function(){
        window.open('http://thedailysave.com/x/<affiliate-id>/');
      });
    </script>
  </body>
</html>

Ok… great… thanks!

But was I correct… do I just change the url’s like I wrote above?

Thanks again,

Doug

Try it. :wink:

I did and it worked great! I am just not sure (but I am assuming it does) if the affiliate variables pass, as the url just says http://thedailysave.com/ on all the links.

I just wanted to make sure that all I need to do was to do is change:

<a class=“daily-save” href=“http://www.google.co.uk/”>A</a>
to

<a class=“daily-save” href=“http://thedailysave.com/north-county-coastal/”>A</a>
Sorry for all the questions… I just want to make sure I am doing it correctly.

Thanks again,

Doug

It won’t if pop-ups are blocked, but it works just find here. Your affiliate URL redirects to the home page, here a quick overview of what happens…


http://thedailysave.com/x/6454q29414/

GET [COLOR=DarkOrange][B]/x/6454q29414/[/B][/COLOR] HTTP/1.1
Host: thedailysave.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://dev.anthonysterling.com/sp/
Cookie: CAKEPHP=3df55l59cit3mkv524oie8f5r6; CakeCookie[hide_welcome]=Q2FrZQ%3D%3D.4Q%3D%3D; CakeCookie[mockingbird_region_id]=1; CakeCookie[referrer_id]=Q2FrZQ%3D%3D.4ggfLL0%3D; __utma=120229837.264518384.1296762197.1296762197.1296766300.2; __utmc=120229837; __utmz=120229837.1296766300.2.2.utmcsr=dev.anthonysterling.com|utmccn=(referral)|utmcmd=referral|utmcct=/sp/; __utmv=; _chartbeat2=c7ouvbc10bp7xeia

HTTP/1.1 [COLOR=DarkOrange][B]302 Found[/B][/COLOR]
Date: Thu, 03 Feb 2011 21:29:04 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.10
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: CakeCookie[referrer_id]=Q2FrZQ%3D%3D.4ggfLL0%3D; expires=Wed, 03-Aug-2011 20:29:04 GMT; path=/; domain=.thedailysave.com
[COLOR=DarkOrange][B]Location: http://thedailysave.com/[/B][/COLOR]
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8

The browser loads the affiliate link, then TheDailySave website records this hit and redirects you with a 302 status and a location of the home page.

Very cool. Thank you again so much Anthony!

  • Doug

Very good information. I’m just now getting into affiliate marketing and this code should be very useful. I’ll save it too. :slight_smile: