A flaw (and a fix) for the link tracking
Jul 21, 2006 02:46 PM
A flaw (and a fix) for the link tracking

The instructions for creating a tracked link to a url in a blog post has a problem. When the url that you are linked to has GET parameters the browser doesn't know which parameters belong to the blog and which belong to the tracked url.

This fix only applies if you have question marks (?) or ampersands (&) in the url you are forwarding to.

For example the url for the previous post on this topic is http://www.4syndication.com/content.do?id=3342&blog=19. To create a forward link from this post to the previous post would require text like this

<a href="http://www.4syndication.com/forward.do?id=1&url=http://www.4syndication.com/content.do?id=3342&blog=19> (Error).

The way around this is a technique called URL encoding. A URL encoding converts the special characters in a URL into their number values so that they don't interfere with the forward request but they are still recognized by the server so that the forward complete's correctly. Here's a working example.

<a href="http://www.4syndication.com/forward.do?id=1&url=http%3A%2F%2Fwww.4syndication.com%2Fcontent.do%3Fid%3D3342%26blog%3D19"> (Correct)

There are plenty of online scripts that do this encoding. The first one I stumbled accross through Google was here. Enter the original URL in the top text box. Press the "URL Encode" button. Use the encoded text as the text after url= in your link request.

Remember, you only need to do this if your URL has question marks (?) or ampesands (&) characters.

Follow up to item: Tracking Links in Blog Postings
Follow ups:
Hosted by 4Syndication Copyright © 2007 4Syndication RSS 2.0