Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: affiliate program link

  1. #1
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default affiliate program link

    I have a few links to affiliate programs on my site, where the text and destinated url is all in a script like this:
    Code:
    <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
    Code:
    <... com/imp?type(js)g(17150696)a(1383984)' class='e' + new String (Math...></sc'+'ript>');
    </script>
    and
    Code:
    <font color="red"><script type="text/javascript">
    var uri = 'http://impbe...
    But none works. How can I adapt this ?

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    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.
    Code:
    <!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.

  3. The Following User Says Thank You to codeexploiter For This Useful Post:

    chechu (08-25-2008)

  4. #3
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    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 ?

  5. #4
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    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.

  6. #5
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    Here's the link
    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.

  7. #6
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    The following is one of the hyperlink's HTML markup that I've copied from firebug

    Code:
    <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

    Code:
    <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.

  8. #7
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    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.

  9. #8
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Add a class to the container. And style through that.

    Code:
    <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.

  10. The Following User Says Thank You to Medyman For This Useful Post:

    chechu (08-25-2008)

  11. #9
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    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

  12. #10
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by chechu View Post
    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
    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •