1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

As a vendor, how to hide affiliate's CB ID in the URL bar ...

Discussion in 'Clickbank' started by OTrap, Apr 22, 2010.

  1. OTrap

    OTrap Jr. VIP Jr. VIP

    Joined:
    Jul 12, 2008
    Messages:
    2,285
    Likes Received:
    1,051
    I have a product that I've had for almost a year, and I'm looking to give it a facelift.

    One of the things I want to do for the affiliates is have their affiliate link not show up in the address bar when someone clicks their link.

    An example would be Michael Jones' Affiliat3 Cod3. When you get to his splash page, the address bar just shows his base URL with /sqvid.html on the end.

    How does one go about coding the site so it will do that?
     
  2. the_demon

    the_demon Jr. Executive VIP

    Joined:
    Nov 23, 2008
    Messages:
    3,177
    Likes Received:
    1,563
    Occupation:
    Search Engine Marketing
    Location:
    The Internet
    Once the page loads you could put code to reload the page.

    PHP:
    <?php
    if ($_GET['affiliateid'] != ""/* simple check to see if affiliate url was used, if it was we reload the page without it */
    {
    header('Location: http://my-domain-with-no-id-after-it.com/');
    ### BEGIN BACKUP METHOD 1 ###
    echo '<META http-equiv="refresh" content="1;URL=http://my-domain-with-no-id-after-it.com/">';
    ### BEGIN BACKUP METHOD 2###
    echo'<script type="text/javascript">
    <!--
    window.location = "http://my-domain-with-no-id-after-it.com/"
    //-->
    </script>'
    ;
    }
    else
    {
    echo 
    "" //we don't need to do anything because they are viewing the page directly
    }
    ?>
    I coded this fairly quickly so you will need to test it for bugs.

    SPECIAL NOTES: Some browsers block the header location based redirect... There are two ways of getting around this...

    Method 1: Use a Meta Refresh (some browsers block this as well)
    Method 2: Load javascript to reload the page.

    If you use all 3 methods it should work 99.9999999999% of the time. I've used this and tested it on all major browsers and yet to see it be stopped.
     
    • Thanks Thanks x 1
    Last edited: Apr 22, 2010
  3. OTrap

    OTrap Jr. VIP Jr. VIP

    Joined:
    Jul 12, 2008
    Messages:
    2,285
    Likes Received:
    1,051
    I see this is PHP. Will that work okay in an HTML doc? I know next to nothing about PHP.
     
  4. jmm223

    jmm223 Registered Member

    Joined:
    Apr 10, 2007
    Messages:
    79
    Likes Received:
    25
    I do it with an htaccess redirect.

    Code:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^hop=
    RewriteRule ^(.*)$ http://www.YOUR_DOMAIN_HERE.com/? [R=301,L]
     
    • Thanks Thanks x 1
  5. the_demon

    the_demon Jr. Executive VIP

    Joined:
    Nov 23, 2008
    Messages:
    3,177
    Likes Received:
    1,563
    Occupation:
    Search Engine Marketing
    Location:
    The Internet
    @jmm223: very good method, using .htaccess slipped my mind lol, yeh way simpler that way.

    @OP
    No, that snippet of code will not work in a html page as PHP is a different language.

    To make it work you could do the following:

    1. rename page from index.html to index.php
    2. copy the snippet of code (checking first perhaps in a sub folder to make sure it's working correctly")
    3. Place the code in the appropriate section of your html code... make sure the php tags are in there

    the begining tag is <?php
    the ending tag is ?>

    If you copy and paste the snippet it you don't need to add those tags obviously. But, they tell the web server to process that chunk off code as php as opposed to html. I recommend placing the code at the top of your page.
     
    • Thanks Thanks x 1
  6. OTrap

    OTrap Jr. VIP Jr. VIP

    Joined:
    Jul 12, 2008
    Messages:
    2,285
    Likes Received:
    1,051
    If I go this route, where would I send the affiliate link to? The .htaccess file?

    I appreciate it.
     
  7. jmm223

    jmm223 Registered Member

    Joined:
    Apr 10, 2007
    Messages:
    79
    Likes Received:
    25
    WHAT?!?! No...you wouldn't send them to any different link. The clickbank affiliate link is what they use.
    When the clickbank link is clicked, they go to the clickbank site which sets a cookie and then redirects to your sales page...except clickbank adds the "?hop=affiliateid" to the url.

    This redirect simply looks for the "hop=" and if it exists, sends them to your site without it.
    The "hop=" part is not needed unless you (the vendor) are using it for something. The cookie is what tracks the sale.

    If you don't know what an .htaccess file is, or how to use it...this method is probably not for you. But then again, the php method probably isn't either. ;)
     
  8. truid

    truid Junior Member

    Joined:
    May 1, 2009
    Messages:
    127
    Likes Received:
    479
    I'm definitely bookmarking this thread. Great information guys!
     
  9. OTrap

    OTrap Jr. VIP Jr. VIP

    Joined:
    Jul 12, 2008
    Messages:
    2,285
    Likes Received:
    1,051
    And that may indeed be the case. I'm a coding newb, and I know it. I'm just trying to figure out how some of this stuff works. I've managed to teach myself a LITTLE html and css, but I'm still almost completely ignorant when it comes to PHP, JavaScript, and anything else.

    I figured I could piece some of this together with help from people on here. Whether or not that's true is up for debate, but I figured I'd at least ask.