1. Home
  2. Knowledge Base
  3. ThirstyAffiliates Pro
  4. How To Use The Destination URL Instead Of Cloaked URL With Autolinker (Skimlinks Compatibility)
  1. Home
  2. Knowledge Base
  3. How Tos and FAQs
  4. How To Use The Destination URL Instead Of Cloaked URL With Autolinker (Skimlinks Compatibility)

How To Use The Destination URL Instead Of Cloaked URL With Autolinker (Skimlinks Compatibility)

In some affiliate programs like Skimlinks, they detect external links on your blog by using an on-page javascript that you have to load on your site.

This poses a problem because ThirstyAffiliates when paired with the Autolinker, will automatically use the cloaked affiliate link.

We created this snippet of code which tells the Autolinker to use the destination URL instead of the cloaked URL which means it's now compatible with tools like Skimlinks.

function swapDestinationURLAutolinker($linkAttributes, $linkID) {
    if (!is_admin()) {
        $linkData = unserialize(get_post_meta($linkID, 'thirstyData', true));
        $destinationUrl = htmlspecialchars_decode($linkData['linkurl'], ENT_COMPAT);
        $linkAttributes['href'] = $destinationUrl;
    }

    return $linkAttributes;
}

add_filter('thirstyFilterLinkAttributesBeforeInsert', 'swapDestinationURLAutolinker', 10, 2);
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support