• Resolved vich11

    (@vich11)


    Hi,

    I was hoping that what the Associate filter did was that it would allow my writers to paste in a regular Amazon product link and that it would insert my affiliate ID into that link, but I guess that’s not how it works. It seems that it replaces an existing affiliate ID with the one specified in the settings area?

    I have a writer who does a weekly post that is ideal for amazon affiliate links, but I don’t want to give him access to my login information. Is there any way to paste in a non-affiliate link and add affiliate ID information?

    Thank you,

    Vic

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Matthew Denton

    (@mdbitz)

    Vic:

    Can you please send me a sample url where this is occurring, should be a simple modification to correct as you require.

    Thanks,
    Matthew J. Denton

    Thread Starter vich11

    (@vich11)

    Matthew,

    Here you go:

    https://screenrant.com/dvd-bluray-new-releases-april-12th-2011-mikee-110384/

    On that page I had visited Amazon, copied the regular, non-affiliate link and pasted it in to my article. All the plugin did was add ?tag=[my affiliate id] twice to the end of the URL.

    Thanks,

    Vic

    Plugin Author Matthew Denton

    (@mdbitz)

    Vic, thanks for sharing the info. The plugin is working as all you need to do is append your affiliate id to a non-affiliate link to make it an affiliate link. However what is happening is that I did not account for there being duplicate links on the page which is causing the double append to occur.

    I have a fix for it by modifying the filter_amazon_associate_tag funtion in WPAA.php to

    public function filter_amazon_associate_tag($content) {
            //Get Matches
            $regex = '|<a.*?href=[""\'](?<url>.*?amazon.*?)[""\'].*?>.*?</a>|i';
            preg_match_all($regex, $content, $matches, PREG_PATTERN_ORDER);
            $filtered_matches = array_unique($matches['url']);
            foreach ($filtered_matches as $key => $match) {
                $orig_str = $match;
                $new_str = $this->replace_associate_tag( $orig_str );
                if( $orig_str != $new_str ) {
                    $content = str_replace($orig_str, $new_str, $content);
                }
            }
            return $content;
        }

    I’ll do a bug release shortly that will include this change.

    > Matthew

    Thread Starter vich11

    (@vich11)

    I’m not sure what you mean by “append your affiliate id to a non-afiiliate link.” I’ve entered my affiliate id in the admin section of the plugin. Also, I did verify that clicking on those links did not register the visit through my affiliate id on Amazon.

    Vic

    Plugin Author Matthew Denton

    (@mdbitz)

    Vic:

    I’ve verified the links are correct. Within the Amazon Associate website under Links & Banners there is a link checker. Using the above modified function for removing duplicate links from the filter the output of a link is as follows: https://www.amazon.com/Harry-Potter-Deathly-Hallows-Part/dp/B001UV4XHY/?tag=scrran-20

    Amazon’s Link Checker will correctly recognizes this as a valid tag for your account as replacing scrran-20 with my associate id is valid.

    > Matthew J. Denton

    Thread Starter vich11

    (@vich11)

    Matthew,

    Ah, thanks – I checked this morning and when I removed the duplicates and clicked through yesterday, Amazon DID register the clicks to my affiliate ID. I look forward to your bug fix update. ??

    Thanks again,

    Vic

    Plugin Author Matthew Denton

    (@mdbitz)

    Hi!

    Version 1.5.1 is released that includes the update so that urls don’t get tagged more than once and are registered correctly.

    Thanks Vic for pointing this issue out to me.

    Matthew

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: WordPress-Amazon-Associate] "Associate Filter" doesn't work the way I expect’ is closed to new replies.