How to Preserve your Query String when Cloaking Affiliate Links

Earlier, I’d written about implementing SubID tracking of affiliate links on the Impact dashboard. However, to track link clicks in Google Analytics, I also cloak them with a predictable pattern. In addition, it doesn’t look as ugly as affiliate links often do. But this creates a problem – how do we preserve the query string for affiliate ID tracking when we cloak the links?

Here are two methods to solve the problem at scale.

1. ThirstyAffiliates Passes Query Strings to the Destination URL

If you’re not using ThirstyAffiliates for link cloaking, you should! It’s one of the few paid plugins I use since the features are so helpful, and it’s well-maintained with regular updates. For example, I use ThirstyAffiliates on my HostGator coupon code 2024 page.

In the ThirstyAffiliates settings, navigate to the tab called “Link Appearance” and you’ll find the following option:

Pass query strings to destination URL?

Here’s a screenshot to see what it looks like:

Pass Query Strings After Cloaking Affiliate Links
Pass Query Strings After Cloaking Affiliate Links

By default, the option is set to “No”, but you can toggle the settings to change that. This will pass all the query parameters to the destination URL and allow you to track the performance of your cloaked URLs.

2. Preserving Query Strings Using Cloudflare Redirects

For my most popular affiliate links, I use the Cloudflare redirect tool. Initially, I used Page Rules, but Cloudflare now has dedicated tools for single redirects and bulk redirect lists. Both of these let you preserve the query string. Here’s a screenshot showing the option to pass the query string using Cloudflare’s single redirect tool:

Cloudflare Preserve Query String for Affiliate Tracking
Cloudflare Preserve Query String for Affiliate Tracking

And here’s the option for the bulk redirect tool:

Cloudflare Bulk Redirects Preserve Query String
Cloudflare Bulk Redirects Preserve Query String

The bulk redirect tool lets you create redirect lists with many more redirects than the single redirect tool at the price of some flexibility, but I find it perfect for affiliate link cloaking.

Stay Away from Redirect Services like TinyURL or Bitly

You should NOT use free services like TinyURL and Bitly for affiliate links, even though they let you preserve the query string. For one thing, you don’t want to pass your data through a third-party site for privacy reasons, and second, you have no guarantee that these links will remain up in the future.

I’ve learned the hard way to avoid free 3rd party services for the proper functioning of my website. Better to either host your own service or pay for it. That’s why I pay for Cloudflare since I rely on it so much!

No Need to Choose Between Cloaking and Tracking

There’s nothing shady about cloaking your affiliate links as long as you comply with all the disclosures and have a privacy section on your website. With ThirstyAffiliates and Cloudflare, you can cloak and track your links!

About Bhagwad Park

I've been writing about web hosting and WordPress tutorials since 2008. I also create tutorials on Linux server administration, and have a ton of experience with web hosting products. Contact me via e-mail!

Speak Your Mind

*

WP-Tweaks