Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get amazon affiliate product Url programatically

I need to get Amazon product affiliate Url programatically without logging in to affiliate-program.amazon.com.

I know how to get it manually. Log into Associates Go to Product Linking -> Product Links

Search for the product and get the Text Link

I want the same programatically just by using ASIN, access key, amazon secret key, and my associate tag.

Thanks in Advance.

like image 681
Abhijoy_D Avatar asked Jun 02 '17 13:06

Abhijoy_D


1 Answers

You can use open-source libraries like Affiliate JS to automatically add the affiliation tags to links on your website.

<script data-aff="amazon.com, www.amazon.com : tag = MY-AMAZON-TAG" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/affiliate.js" async id="aff-js"></script>

Just simply replace MY-AMAZON-TAG with the tag that you made in Amazon (that probably looks like my-tag-20) and add the HTML right above the </head>. If you want to affiliate your URLs manually, simply add ?tag=my-tag to the end.

Before: https://www.amazon.com/dp/B0042TVKZY/
After: https://www.amazon.com/dp/B0042TVKZY/?tag=MY-AMAZON-TAG

Before: https://www.amazon.com/dp/B0042TVKZY/ref=longvndjks?nsjklasd=nkdnc
After: https://www.amazon.com/dp/B0042TVKZY/?tag=MY-AMAZON-TAG
like image 200
Russell Avatar answered Nov 15 '22 05:11

Russell