JS Redirect For Aff Link - Need help

pallyD

Junior Member
Joined
Aug 6, 2010
Messages
137
Reaction score
95
Code:
[COLOR=#FFFFCC]<a id="link" href="http://google.com" onclick="go();">Google</a> \\Put your regular .com link in this part[/COLOR]


[COLOR=#FFFFCC]<script type="text/javascript">[/COLOR]


[COLOR=#FFFFCC]function go() {[/COLOR]


[COLOR=#FFFFCC]document.getElementById('link').href = 'http://google.com/pda'; \\then put the aff link here[/COLOR]


[COLOR=#FFFFCC]}[/COLOR]


[COLOR=#FFFFCC]</script>[/COLOR]

This would give me a link to click and redirect to cloaked link, but I need it so it redirects immediately, i.e. no clicking just right as the user loads the page like a 301.
 
HTML:
<script type="text/javascript">
window.location.href="somelink";
</script>

put this code before the title tag. I didn't test it out, but pretty sure it should work. Then again I've been up for about 20 hours right now...
 
is there a reason you are using javascript as opposed to PHP? Here is what I do for my affiliate links:

1). Create a new folder on your hosting called "go" or "out".
2). In the folder, create a new page called index.php
3). paste this code in the index.php page:

Code:
<?php

   header( 'Location: http://www.affiliatesite.com/affiliatelinkID' ) ;


?>

4. When you create the page on your site, your new link will be www.yoursite.com/go
 
Agree with above as a server side answer would be best, as js can always be altered by the client.
 
Sorry to hijack this thread and forgive my noobs question,can you guys say why do we need to use this redirect script??
 
Sorry to hijack this thread and forgive my noobs question,can you guys say why do we need to use this redirect script??

You by no means NEED to use it, but cloaking your link from a potential buyer may prevent them from taking your commission when they buy.

@RightInTwo That will prevent them from seeing it when clicking, but e.g. ClickBank has the ?hop=pallyD at the end of the URL, but when you use php redirect the hop will still show. I managed to go to the google homepage with script I used, but it showed up in the browser URL box as google.com/pda, so I assume I can have it not show a "?hop=pallyD" while still giving me the commission.
Is this true at all?

For the meantime I just have the PHP redirect going until I can get this to work.
 
You by no means NEED to use it, but cloaking your link from a potential buyer may prevent them from taking your commission when they buy.

@RightInTwo That will prevent them from seeing it when clicking, but e.g. ClickBank has the ?hop=pallyD at the end of the URL, but when you use php redirect the hop will still show. I managed to go to the google homepage with script I used, but it showed up in the browser URL box as google.com/pda, so I assume I can have it not show a "?hop=pallyD" while still giving me the commission.
Is this true at all?

For the meantime I just have the PHP redirect going until I can get this to work.

You can use a double meta refresh to cloak the link and also hide the referrer.
 
You can use a double meta refresh to cloak the link and also hide the referrer.

That's genius mate, and it seems to work with ClickBank. Thanks very much.
 
That's genius mate, and it seems to work with ClickBank. Thanks very much.

Happy to help. In fact, I think somewhere on my computer I have a script if you want it. PM me if you do and I can try and find it.
 
Back
Top