Work At Home Options

How To Stuff Clickbank Affiliate Cookies Using .htaccess

Because of my recent article on cloaking affiliate links using .htaccess, I’ve been getting quite a few requests for information on how to stuff affiliate cookies. Cookie stuffing is bad! Or so I hear. There may very well be times when it is acceptable to stuff affiliate cookies such as when you have permission from a vendor. So here’s how to do it.

And, I’m going to assume that you are about to mail your huge list of 10,000 prospects and want to get paid for those efforts so you’ve talked to the vendor and he says, “heck yeah, stuff those cookies. I want to make sure you get credit for all the sales you send”.

There are several ways to do it, this is just one of them.

Create a folder and name it something that makes sense and sounds innocent.

For this example, I’ll use adcounter.

Paste this code into a text file and save as .htaccess , upload to the adcounter folder (or which ever folder you create)

RewriteEngine On
RewriteRule (.+)/(.+).gif http://YOUR-ID.$$2 [R,L]

Now, paste this code into your webpage

<img src=”” width=”1″ height=”1″ border=”0″ alt=” ” />

The TID is the extra word that can be tracked so you know where your sales came from when viewing your clickbank sales transactions and will display on the clickbank order page along with your affiliate id.

If your not familiar with using the TID field when generating your clickbank links, just use a benign word like “count”. This way you’ll know which sales came from the stuffed cookies.

It would be best to drop this code into your page right next to an existing banner if there is one or another image if not. Someone looking at the source code for your page would more than likely assume that this was just an image used to track banner displays. If you’ve used links from CJ then you’ve already seen the 1×1 images in the code they use for tracking.

Ok, so what about stuffing other affiliate cookies besides Clickbank?

So we’ll create another folder and this time I’ll use countview.

Open up a text editor and paste the following code into it and save it as .htaccess , upload it to the countview folder (or which ever folder you create). Change the links first!

RewriteEngine On
RewriteRule product1.gif [R,L]
RewriteRule product2.gif [R,L]

When you want to drop a cookie, just add a new line

<img src=”” width=”1″ height=”1″ border=”0″ alt=” ” />

For an example, let’s say I was wanting to drop a cookie for SurveyKing, I would add the following line to my .htaccess file.

RewriteRule surveyking.gif [R,L]

I would then use the following image code on the page I wanted to stuff the affiliate cookie.

<img src=”” width=”1″ height=”1″ border=”0″ alt=” ” />

You just match the .gif name with the .gif name in the .htaccess file and tell it where to send it. Add as many lines as you want.

Again, I’m providing this example of affiliate cookie stuffing with the belief that it will be used only where allowed. Many merchant companies have strict policies against cookie stuffing and may terminate your affiliate counts and in some cases, may even take you to court.

On the other hand, if you are mailing a huge subcriber list or starting an expensive pay per click or other kind of paid advertising campaign, you want to get paid. It’s important that you receive all credit from the sales you generate. Talking with the vendors you wish to promote in advance may clear the path for setting some cookies. They may even be willing to set you up with your own private landing pages to send traffic to. I’ve worked out those type of arrangements myself with Clickbank vendors before so I know it can happen.

Till next time,

P.S. Don’t stuff all the cookies, be sure and leave a few for Santa!


Additional Articles From "Technical"

4 Responses to “How To Cloak Affiliate Links Using Htaccess”

  1. AffiliateMusketeer on November 20th, 2008 at 4:37 am

    Thanks, Gail, great post! I got a little confused around the ‘how to count the cloaked links’ section but I think that was more due to the time (3am) than anything else. I have tried your methods again this morning though and they work perfectly.

    I’m using it on an unindexed landing page, driving traffic via PPC, and promoting a clickbank product. So far so good…

  2. Glad you were able to get it going! Your problem with understanding probably had less to do with it being 3am when you were reading and more to do with it being 3am when I wrote it. ;)

  3. Hi Gail,

    I tried your cloak link for clickbank, and it worked perfectly on the first time. the same cloak link can be used for commission junction as well?. I looked at your cloak link generator, not sure I understood it well, to give it a try.
    thanks for your help Gail.

    Warm regrds

  4. Hi Charles,

    Glad you were able to use the clickbank code easily. I don’t use CJ much and haven’t tried to see if I could cloak the links. For the misc items I do promote, I use my own url shrinker. You can see it at , you are free to use that one if you like or you can install the script and use on your own site. You can download it at , I also put a link to it in the freebies section. It’s easy to install and the readme file is included. If you have any problems with it, just let me know. On a side note, I think it would not be difficult to do Ebay links and I’ll look at that sometime soon.

    Take care,

  5. Hi Gail,

    Thank you so much for the reply. the url shrinker seems attractive. No Gail I did not use it yet, though just tested it. Just saw your reply, thought I will say thanks. will catch up with you once I try it out. Thanks again Gail.

    Warm Regards

  6. hi nice post pretty useful I got this to work, although it would be nice to know how to also include .html extension on the end instead of just I’m sure this can be all done in .htaccess file just not sure I’m a little bit of a green horn lol!

  7. Hi Sheldon,

    It’s no problem to add the .html to the end.

    RewriteRule ^(.*)

    RewriteRule ^(.*)\.html

    Then your link would look like

    This works with clickbank as well. And you can change the html to any file extension you want. It is basically just ignored anyway.

  8. hi,dear

    thanks for useful tips you let me to know more about .htaccess.
    how i can indexing my newly created sites using .htaccess in search engines like google?

    thanks alot for article.

  9. Whoa… this site is pretty awesome :) your layout is really well designed, and your blogs are (judging from what i’ve read) very interesting. heehee… consider yourself favorited. :-P

  10. Hello, I enjoy reading through your blog, I wanted to leave a little comment to support you and wish you a good continuation. Wishing you the better of luck for all your blogging efforts.

  11. Flippa Chick on May 10th, 2010 at 5:36 pm

    Excellent post! I’ve switched over one of my dynamic websites to a static .html website and was looking for a more efficient way to cloak my Amazon links since I couldn’t use the features of plugins.

    Thanks for sharing! :)

  12. Amazon Links idea great. I’m going to try it with my Amazon affiliate sites. thank you.

Leave a Reply

free forex softwares