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:
http://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
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
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: http://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
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