[CDB] Amazon Affiliate

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Get Involved
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
Locked
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 4016
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

[CDB] Amazon Affiliate

Post by HiFiKabin » Tue Jun 16, 2015 12:55 pm

Extension Name: Amazon Affiliate Image
Author: HiFiKabin

Extension Description: Adds the ability to add your own Amazon Affiliate code the following Amazon or Amzn TLD links posted on your forum. You only need to enter one Affiliate Code per TLD, the extension automatically adds it to both amazon and amzn. Any existing Affiliate Code is stripped first. Javascript needs to be enabled on the users browser for the Affiliate Code to be added.

co.uk, .com, .fr, .de, .ca, .co.jp, .it, .cn, .es, .in, .com.au, .com.mx

Language:
  • en
  • Additional languages: ar, fr, here
Extension Version: 1.0.4

Supported Styles:
  • All
Based on: Affililink v0.21 by Dean Barrow

Demo: Download: Screenshots:

Image

Installation:
  • Download the latest release and unzip it.
  • Upload the the folder hifikabin to root/ext/ and enable it in the ACP
Support:

The contact us link at the bottom of this Forum or CDB Topic
Last edited by HiFiKabin on Tue Mar 07, 2017 4:03 pm, edited 28 times in total.

Nully
Registered User
Posts: 453
Joined: Thu Jan 29, 2009 10:11 pm
Location: France
Contact:

Re: Amazon Affiliate

Post by Nully » Tue Jun 16, 2015 1:33 pm

Thanks a lot. As soon as my forum online will be version 3.1 I'll install it :)

User avatar
Meykota
Registered User
Posts: 30
Joined: Sat Aug 16, 2014 5:19 pm
Location: Leipzig, Germany
Contact:

Re: Amazon Affiliate

Post by Meykota » Tue Jun 16, 2015 9:44 pm

Wonderful, thanks for this :)
Is this working with all amazon-codes or just with amazon.com?

And is this working with all kind of codings in posts, such like [ url=amazon.com]such a wonderful car[/url]?

User avatar
cYbercOsmOnauT
Registered User
Posts: 362
Joined: Wed Jun 16, 2004 8:22 am
Location: Goettingen, Germany
Name: Tekin Birdüzen

Re: Amazon Affiliate

Post by cYbercOsmOnauT » Tue Jun 16, 2015 11:16 pm

Nice... but... you add the affil-part with a small JS in the footer. Is it okay when spiders crawl the links without it?

Also I think that a selector like yours $("a[href*='amazon']") is too blurry. I would at least change it to $("a[href*='.amazon.']") or put a check inside the each. Just a friendly advice :)
phpBB-installation and reparation. Prof. PHP coding with function guarantee. Just contact me at: t.birduezen@web-coding.eu.
Ex-German Support Team Member | phpBB Development Environment

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 4016
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: Amazon Affiliate

Post by HiFiKabin » Wed Jun 17, 2015 8:36 am

Meykota wrote:Wonderful, thanks for this :)
Is this working with all amazon-codes or just with amazon.com?

And is this working with all kind of codings in posts, such like [ url=amazon.com]such a wonderful car[/url]?
It should tag your code on to any and all versions of links and Amazon TLD's
cYbercOsmOnauT wrote:Nice... but... you add the affil-part with a small JS in the footer. Is it okay when spiders crawl the links without it?
I don't think it will make any difference as the crawlers don't make use of your affiliate code anyway. It is only useful when it is clicked.
cYbercOsmOnauT wrote:Also I think that a selector like yours $("a[href*='amazon']") is too blurry. I would at least change it to $("a[href*='.amazon.']") or put a check inside the each. Just a friendly advice :)
Thanks, I'll look into it.

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25388
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Amazon Affiliate

Post by Paul » Wed Jun 17, 2015 8:38 am

Hello,

Please edit your topic title with a prefix as outlined in Extensions Development Forum Rules, section 3a. This will allow people to see the development status of your extension at a glance.

Thank you,
The phpBB Extensions Team
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 4016
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: Amazon Affiliate

Post by HiFiKabin » Wed Jun 17, 2015 8:40 am

Paul wrote:Hello,

Please edit your topic title with a prefix as outlined in Extensions Development Forum Rules, section 3a. This will allow people to see the development status of your extension at a glance.

Thank you,
The phpBB Extensions Team
:oops: Sorry Paul, senility is coming early :roll:

User avatar
cYbercOsmOnauT
Registered User
Posts: 362
Joined: Wed Jun 16, 2004 8:22 am
Location: Goettingen, Germany
Name: Tekin Birdüzen

Re: Amazon Affiliate

Post by cYbercOsmOnauT » Wed Jun 17, 2015 10:22 am

HiFiKabin wrote:
cYbercOsmOnauT wrote:Also I think that a selector like yours $("a[href*='amazon']") is too blurry. I would at least change it to $("a[href*='.amazon.']") or put a check inside the each. Just a friendly advice :)
Thanks, I'll look into it.
I don't really know which hosts Amazon own, but I would use something like this

Code: Select all

var href_val;
$("a[href*='amazon']").each(function() {
    href_val = this.href + '{AMAZONAFFILIATE_CODE}'; // Doesn't matter for the check
    if (href_val.test(/^https?:\/\/([a-z0-9.-]+\.)?amazon\.[a-z]+\//)) {
        this.href = href_val;
    }
});
I didn't test this snippet. It's just a written down idea.
phpBB-installation and reparation. Prof. PHP coding with function guarantee. Just contact me at: t.birduezen@web-coding.eu.
Ex-German Support Team Member | phpBB Development Environment

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 4016
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: Amazon Affiliate

Post by HiFiKabin » Wed Jun 17, 2015 11:05 am

cYbercOsmOnauT wrote:
HiFiKabin wrote:
cYbercOsmOnauT wrote:Also I think that a selector like yours $("a[href*='amazon']") is too blurry. I would at least change it to $("a[href*='.amazon.']") or put a check inside the each. Just a friendly advice :)
Thanks, I'll look into it.
I don't really know which hosts Amazon own, but I would use something like this

Code: Select all

var href_val;
$("a[href*='amazon']").each(function() {
    href_val = this.href + '{AMAZONAFFILIATE_CODE}'; // Doesn't matter for the check
    if (href_val.test(/^https?:\/\/([a-z0-9.-]+\.)?amazon\.[a-z]+\//)) {
        this.href = href_val;
    }
});
I didn't test this snippet. It's just a written down idea.
Thanks for that. The .amazon. didn't work for non www links (the leading . broke the extension) I'll have a play with your idea and see how it works out.

User avatar
cYbercOsmOnauT
Registered User
Posts: 362
Joined: Wed Jun 16, 2004 8:22 am
Location: Goettingen, Germany
Name: Tekin Birdüzen

Re: [RC] Amazon Affiliate

Post by cYbercOsmOnauT » Wed Jun 17, 2015 11:17 am

The regex takes that in account and works with amazon and something.amazon
phpBB-installation and reparation. Prof. PHP coding with function guarantee. Just contact me at: t.birduezen@web-coding.eu.
Ex-German Support Team Member | phpBB Development Environment

Swanny
Registered User
Posts: 444
Joined: Sun Apr 14, 2002 2:11 am
Location: Canada

Re: [RC] Amazon Affiliate

Post by Swanny » Thu Jun 18, 2015 5:47 am

Thanks I will check this out soon.

Does it also handle amzn.com domain? That is a URL shortener that I have seen some people use.

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 4016
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: [RC] Amazon Affiliate

Post by HiFiKabin » Thu Jun 18, 2015 7:32 am

Swanny wrote:Thanks I will check this out soon.

Does it also handle amzn.com domain? That is a URL shortener that I have seen some people use.
No, it does not handle that (and TBH I have never seen that myself) but I should be able to add it to the Ext on the next update.

User avatar
cYbercOsmOnauT
Registered User
Posts: 362
Joined: Wed Jun 16, 2004 8:22 am
Location: Goettingen, Germany
Name: Tekin Birdüzen

Re: [RC] Amazon Affiliate

Post by cYbercOsmOnauT » Thu Jun 18, 2015 9:23 am

Swanny wrote:Does it also handle amzn.com domain? That is a URL shortener that I have seen some people use.
That's Bitly. To make the Extension handle this you have to use the API of Bitly and extend the short-URL to add the Affilcode. Or use curl to see where the link redirects you on post submit and replace the short link with the long one.
phpBB-installation and reparation. Prof. PHP coding with function guarantee. Just contact me at: t.birduezen@web-coding.eu.
Ex-German Support Team Member | phpBB Development Environment

Swanny
Registered User
Posts: 444
Joined: Sun Apr 14, 2002 2:11 am
Location: Canada

Re: [RC] Amazon Affiliate

Post by Swanny » Sat Jun 20, 2015 6:31 am

I discovered today that Amazon also uses amzn.to domain name to send people to product pages.

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 4016
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: [RC] Amazon Affiliate

Post by HiFiKabin » Sat Jun 20, 2015 8:44 am

1.0.0_rc2 also adds your affiliate code to amzn domains

Update from previous version:
  • Download the latest release and unzip it.
  • Disable Amazon Affiliate in the ACP
  • Delete amazonaffiliate folder from the server
  • Upload the the folder hifikabin to root/ext/ and enable it in the ACP
Last edited by HiFiKabin on Thu Sep 03, 2015 7:38 am, edited 1 time in total.

Locked

Return to “Extensions in Development”