Hiding tracking pixels with CSS.

If you want to integrate CJ or Linkshare HTML links into your blog posts, you’ve probably noticed that “hidden” pixel doesn’t stay so hidden – it turns into a white space. Or, even more annoying, if you have pretty CSS borders and spacing to make your post images look nice, suddenly you have this stupid honking framed pixel with lots of blank space all around it.

I don’t have a solution for the 1 pixel white space issue, except to suggest that you use it as a space in your text. If you want to follow the link with words, just type them right up against it instead of putting in a space. If you want a comma or period, put that INSIDE the link, then use the pixel image as a space before the next clause or sentence begins. At least it works.

As for the pretty CSS issue, I do have a solution, which I found at the Wordpress forum. If you use “.post img” to define the pretty spaces and borders around your normal post images, you need to define another class for your tracking pixel images, say “img.aff”. Then on each tracking pixel image source code, you’ll need to add “class=”aff” right after img and before src. If you have lots of affiliate links already that you want to change, try using the Search and Replace plugin to find the code and replace it all at once. You’ll need to search for a unique string to avoid applying this class to every image in your posts, so for example:

  • Search for img src=”http://ad.linksynergy.com
  • Replace with img class=”aff” src=”http://ad.linksynergy.com

And that will get all your LinkShare links at one go. CJ’s a little more annoying because of all their nonsense letter domains, but you just do them one by one and then it’s all done.

It’s probably very possible to write a plugin that would do this. I’ve never even attempted to write one, but if people comment expressing interest, I’ll do some research and see if I can whip something up.

Related posts:
  1. Better stats tracking than AwStats?
  2. Link a Dink – better than Alinks
  3. Automatically optimize Wordpress images with Smush It
  4. Cookie Tracking and Vulnerable Affiliate & Ad Networks
  5. Awesome screen capture software

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>