Log in

View Full Version : affiliate program link



chechu
08-25-2008, 07:45 AM
I have a few links to affiliate programs on my site, where the text and destinated url is all in a script like this:

<script type="text/javascript">
var uri = 'http://impbe.tradedoubler.com/imp?type(js)g(17150696)a(1383984)' + new String (Math.random()).substring (2, 11);
document.write('<sc'+'ript type="text/javascript" src="'+uri+'" charset="ISO-8859-1"></sc'+'ript>');
</script>
Problem is that the script seems to override css based orders, like the color of the link. I tried this

<... com/imp?type(js)g(17150696)a(1383984)' class='e' + new String (Math...></sc'+'ript>');
</script>
and

<font color="red"><script type="text/javascript">
var uri = 'http://impbe...
But none works. How can I adapt this ?

codeexploiter
08-25-2008, 08:53 AM
Here is an example for the one you are looking. In this example I used to load the affiliation script file inclusion in the head section of the page and in its window's onload event I used to track the anchor element(s) created by the affiliation script.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled Document</title>
<style type="text/css">
.affl{
color:green;
}

</style>
<script type="text/javascript">
var uri = 'http://impbe.tradedoubler.com/imp?type(js)g(17150696)a(1383984)' + new String(Math.random()).substring(2, 11);
document.write('<sc' + 'ript type="text/javascript" src="' + uri + '" charset="ISO-8859-1"></sc' + 'ript>');
</script>
<script type="text/javascript">
window.onload = function(){
var as = document.getElementsByTagName('a') ;
for(var i = 0; i < as.length; ++i){
if(as[i].href.indexOf('http://clk.tradedoubler.com/click') != -1){
as[i].className = "affl";
}
}
}
</script>
</head>
<body>
</body>
</html>


I used to track the affiliation links through the href value..

Hope this helps.

chechu
08-25-2008, 09:02 AM
Difference with your example is that my links are not in the head, but in the body, and there are four I have. How can I include them in the body, using your solution ?

codeexploiter
08-25-2008, 09:27 AM
Can you please provide a link to the page you are referring, so that I can have a look. The above mentioned strategy should work in that case also under normal circumstances. In my method I used to call the routine to check the anchor elements in the onload of window object, which will be triggered only after loading the complete page DOM. But the issue that can occur is with the indexOf operation I've done, I don't know how exactly your affiliation links looks. Before anything I need to get a good look on those or if there is any generic pattern for those links we can use that pattern for the checking.

chechu
08-25-2008, 10:23 AM
Here's the link (http://www.hetbestevoordeel.be)
If you look at the four links in the green box, and then you go in the menu to another page (f.ex. CenterParcs), you will see that the color of the links is different, because the four ones in the index are scripts, while the other ones are <a href>, where the css is applied to.

codeexploiter
08-25-2008, 11:27 AM
The following is one of the hyperlink's HTML markup that I've copied from firebug


<a target="_blank" href="http://clk.tradedoubler.com/click?p=3106&amp;a=1383984&amp;g=16862766&amp;url=http://www.centerparcs.be/VL/BE/aanbieding/najaarsaanbieding_2008">huidig beste voordeel CenterParcs: 100 euro korting</a>

The following is the markup of one of the problematic hyperlink


<a class="a" target="_blank" href="http://clk.tradedoubler.com/click?p=3106&amp;a=1383984&amp;g=16862766&amp;url=http://rms.admeta.com/public/transfer.asp?sitebanner_id=831901">last minutes CenterParcs: wil je er snel nog even tussenuit</a>

The only difference between the first one and the second one is the second has a class name associated with it (highlighted). If you remove that class from the markup the link will look similar to the first one.

Hope this helps.

chechu
08-25-2008, 02:11 PM
I know, but the links above have the color I want, due to the class. So these are the correct ones. My problem is that I cannot use the class with the links that are in javascript.
You used the first link as an example. Please use the second to fourth one.

Medyman
08-25-2008, 04:41 PM
Add a class to the container. And style through that.


<td class="link"><script...></script></td>

td.link a {
color:red;
}

By the way, you really shouldn't be using tables like you are. They're not meant for layout.

chechu
08-25-2008, 06:52 PM
Thanks a lot, it works perfectly !
About the tables, I know, but I got it from a template, and I have no idea how to place it into divs.
Here's the template from: http://www.web-garden.be (http://www.web-garden.be/templates/template.php)

Medyman
08-25-2008, 10:33 PM
About the tables, I know, but I got it from a template, and I have no idea how to place it into divs.
Here's the template from: http://www.web-garden.be (http://www.web-garden.be/templates/template.php)

Ahh, makes sense. I don't know why template makers are so lazy. I guess they assume that if someone is using templates, they must not know proper coding techniques.

chechu
08-26-2008, 07:56 AM
I guess they assume that if someone is using templates, they must not know proper coding techniques.

Like me !!