WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#34614 closed defect (bug) (invalid)

Wordpress breaks Amazon affiliate link tracking

Reported by: cookieandkate Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Editor Keywords:
Focuses: ui Cc:
PR Number:

Description

Hello,

I've discovered that every time I switch from the post/page code editor to the visual editor, Wordpress inserts extra characters in my Amazon affiliate links. More specifically, it inserts the letters amp; after each ampersand symbol. This seems to automatically happen when the link is inserted in the visual editor, too. I'll paste examples here, but Wordpress messes with them even in these forum situations, so I'm not sure you'll be able to see it.

Original link as provided by Amazon:

<a rel="nofollow" href="http://www.amazon.com/gp/product/B0007Y9WHQ/ref=as_li_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B0007Y9WHQ&linkCode=as2&tag=myaffiliatetag-20&linkId=HMVJSFJ5HEIDZRJ2">Product Title</a>

Wordpress output upon switching from visual to text editor:

<a href="http://www.amazon.com/gp/product/B0007Y9WHQ/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B0007Y9WHQ&amp;linkCode=as2&amp;tag=myaffiliatetag-20&amp;linkId=HMVJSFJ5HEIDZRJ2" rel="nofollow">Product Title</a>

I've deactivated all of my plugins and switched to the Twenty Fifteen Wordpress theme. The issue persists in that scenario, so I believe it to be caused by Wordpress itself.

I've tested these links in Amazon's broken link checker, which says that the links FAIL with the extra letters in the code. "Fail: The link above was not tagged or was not a valid Amazon link."

I've also confirmed with Amazon associates that these links are not trackable, which means that I'm not earning affiliate revenue for the sales generated from those links. Here's their response:

"I first tested the second link that you provided which had the WordPress inserted characters added and unfortunately I found that the link is not formatted correctly. Unfortunately, In this situation, your Link Checker was correct. This tool is intended primarily however for people constructing or modifying their own Associate links to Amazon.com.

I would also like to apologize that because we are unable to track any activity and sales placed via this link and any other link that would have this type of added coding, there wasn't any way to track sales that might have been made through those links.

Since we are unable to provide HTML techniques beyond the code we provide in Associates Central, you might want to continue to get in contact with the WordPress technical support team about these added characters that were inserted on your website."

I run a reputable food blog and use Amazon affiliate links to link to relevant cooking products within my posts. I'm very disappointed that a core Wordpress functionality is preventing me from earning rightfully earned Amazon affiliate revenue. I've started replacing the defunct Amazon links with shortened Amazon links, which Amazon offers. They don't include ampersand signs so I don't think they'll break. I recommend self-hosted Wordpress solutions to all other food bloggers, but this is a big downside. I hope someone can prevent this issue from happening in the future! I also feel like Wordpress should let their users know to check their links.

Change History (3)

#1 @nullvariable
4 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

Hi cookieandkate,

What you're experiencing is normal behavior for links all over the web. The ampersand is a special, reserved character in HTML, to ensure that it's understood by browsers properly, the ampersand should never be used alone. A browser can't be sure what you mean if an amperspand is followed by what are considered ambiguous characters (ie something not defined in the standard), so all ampersand characters should be encoded. Here's some more info on the technical standard: http://www.w3.org/TR/html5/syntax.html#syntax-ambiguous-ampersand

When you click a link with an encoded ampersand, your browser will convert the &amp; notation into the correct ampersand symbol only, removing the &amp; from the link and replacing it with & before sending it to the server. All of your links should work correctly, and you should be able to confirm this by clicking the link and taking a look at it after you land on the Amazon page.

Here's a link to the WordPress Codex that explains a bit about how WordPress sanitizes URLs: https://codex.wordpress.org/Data_Validation#URLs

You can disable this feature in WordPress by removing the appropriate filter from your posts, but you will be putting yourself at high risk with security and I would not recommend doing so.

#2 @cookieandkate
4 years ago

Hi nullvariable,

Thank you for your help. I just tried clicking on one of those faulty links and the browser automatically removed all the extra amp;s, so I believe you when you say they're working! If I copy and paste that URL to a new window, my browser doesn't correct it, and if I paste the URL into Amazon's broken link checker, it tells me it's failed. Very confusing.

Thank you for explaining how this all works. Glad to know that the links are working after all!

Best,

Kate

#3 @johnbillion
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution changed from worksforme to invalid
Note: See TracTickets for help on using tickets.