Topic Wiki

UPDATE:
@JoeyShmoe did a great job creating a Chrome Extension and a Firefox Extension to save us all the hassle of setting up a bookmarklet. The extension will place a button on any Amazon product page. When you click the button it will copy a link to your clipboard, which you can paste into any DDF post. The post will then contain the product title, image, and a working link to the product.

Thanks @JoeyShmoe!

---

For anyone who doesn't want to install a browser extension, read below how to set up the bookmarklet:

Here is a bookmarklet that will make a DD link from any amazon item page, and format it with the title and an image so you can paste it into a DDF post.

Example:

Little Tikes Rocking Horse Magenta ($34.07)



(Not sure what a bookmarklet is? Read more about them in this thread: http://forums.dansdeals.com/index.php?topic=61269.5.)

Here's how to install the bookmarklet:

1. If you don't currently see a row of bookmarks on the top of your browser, you will need to show the bookmarks bar.
- In Chrome, click the 3 vertical dots at the top right of your screen, click Settings, and click Always Show the Bookmarks Bar.
- In Firefox, click the 3 horizontal lines at the top right of your screen, and click Customize. Then click Show/Hide Toolbars (bottom left of your screen) and check off the Bookmarks Toolbar.

2. Copy the following code. (To do so, click the SELECT button and then press control-c on your keyboard.)
Code: [Select]
javascript: (function() {
    var pattern = new RegExp("(https:\/\/www.amazon.com\/).*([dg]p\/)(?:product\/)?(..........).*|(https:\/\/smile.amazon.com\/).*([dg]p\/)(?:product\/)?(..........).*", "i"),
        match = location.href.match(pattern),
        image = document.getElementById('landingImage').src;
    var price = "";
    if (document.getElementById('priceblock_dealprice') !== null) {
        price = " (" + document.getElementById('priceblock_dealprice').innerHTML + ")";
    } else if (document.getElementById('priceblock_ourprice') !== null) {
        price = " (" + document.getElementById('priceblock_ourprice').innerHTML + ")";
    }
    var URL = (match[1] !== undefined) ? match[1] + "dp/" + match[3] + "/?tag=cl03f-20&smid=ATVPDKIKX0DER" : match[4] + "dp/" + match[6] + "/?tag=cl03f-20&smid=ATVPDKIKX0DER";
    var result = "[url=" + URL + "]" + document.title + price + "[/url][br][br][url=" + URL + "][img]" + image + "[/img][/url]";
    if (document.execCommand('copy') !== false) {
        var ddLink = document.createElement('span'),
            range = document.createRange();
        ddLink.id = "ddLink";
        ddLink.innerText = result;
        document.body.appendChild(ddLink);
        range.selectNode(document.getElementById('ddLink'));
        window.getSelection().addRange(range);
        document.execCommand('copy');
        document.getElementById('ddLink').remove();
        setTimeout(function() {
            alert('DD link copied to clipboard...')
        }, 1000);
    } else {
        window.prompt("Press control-c", result);
    }
    void(0);
})()

3. To create the bookmarklet, right click on your bookmarks bar and click "Add page" (if you're in Chrome) or "New bookmark" (Firefox).

For the Name, enter whatever you want (eg: Dan Amazon link), and for the URL/Location enter the code above, which you already copied.

4. Click Save (Chrome) or Add (Firefox)

To use the bookmarklet, simply click on the bookmark you created (in step 3) when you are on any amazon product page. Follow the prompts (you may need to press control-c to copy what pops up), and then paste it into any DDF post.

Enjoy!

Disclaimer: The code might need a little tweaking, so let me know if you have a link that it doesn't work on. If there are any changes I will update the wiki.

Author Topic: Amazon DD Bookmarklet: Have Chrome Make A DDF Friendly Link On Amazon  (Read 7284 times)

Online aygart

  • Dansdeals Presidential Platinum Elite
  • ********
  • Join Date: May 2008
  • Posts: 4388
  • Total likes: 366
  • DansDeals.com Hat Tips 5
    • View Profile
    • Lower Watt Energy Brokers
  • Programs: www.lowerwatt.com
@etech0 I'd like to suggest 2 changes, 1) remove https:\/\/www. from the RegExp, this way it works if you have your Amazon auto redirect to smile.amazon.com like I do, and 2) remove all the repetetive var and semicolons from the variables and instead have them comma delimited, much cleaner and more correct :)

See my edits to your awesome code below:

The question was if that negates Dan's referral code.
You have the right to remain silent. Anything you say can and will be used to start a religious discussion.

Offline Dan

  • Administrator
  • Dansdeals Lifetime 40K Presidential Platinum Elite
  • **********
  • Join Date: May 2008
  • Posts: 47478
  • Total likes: 564
  • DansDeals.com Hat Tips 15685
  • Gender: Male
    • View Profile
  • Location: CLE
  • Programs: UA Global Services, AA Lifetime Plat, DL Dirt, SPG Plat, Hyatt Diamond, Fairmont Lifetime Plat, Hilton Diamond, Priority Club Plat, Avis Chairman, National EE, Hertz PC
The question was if that negates Dan's referral code.
If someone has a random uncommon item to order we can test it out. Amazon automatically doesn't count my own orders.
Really appreciate the support.
Save your time, I don't answer PM. Post it in the forum and a dedicated DDF'er will get back to you as soon as possible.

Offline JoeyShmoe

  • Dansdeals Platinum Elite + Lifetime Gold Elite
  • ******
  • Join Date: Nov 2014
  • Posts: 952
  • Total likes: 33
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
  • Location: Lakewood
The question was if that negates Dan's referral code.
Seems like the question was answered already
It seems from https://affiliate-program.amazon.com/help/node/topic/202049200 than smile donations do not affect affiliate commission.
DDF A-Z Link Extension
Chrome
Firefox
Info

Offline JoeyShmoe

  • Dansdeals Platinum Elite + Lifetime Gold Elite
  • ******
  • Join Date: Nov 2014
  • Posts: 952
  • Total likes: 33
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
  • Location: Lakewood
If someone has a random uncommon item to order we can test it out. Amazon automatically doesn't count my own orders.
Really appreciate the support.
I'll test it, how long until  you can see if you got anything from it? Is there a minimum item price?
DDF A-Z Link Extension
Chrome
Firefox
Info

Online aygart

  • Dansdeals Presidential Platinum Elite
  • ********
  • Join Date: May 2008
  • Posts: 4388
  • Total likes: 366
  • DansDeals.com Hat Tips 5
    • View Profile
    • Lower Watt Energy Brokers
  • Programs: www.lowerwatt.com
Seems like the question was answered already
Quote
Amazon Associates may earn referral fees by sending traffic to smile.amazon.com or www.amazon.com. You do not need to register for AmazonSmile in order to earn Associate Program referral fees from AmazonSmile purchases.
You have the right to remain silent. Anything you say can and will be used to start a religious discussion.

Offline Dan

  • Administrator
  • Dansdeals Lifetime 40K Presidential Platinum Elite
  • **********
  • Join Date: May 2008
  • Posts: 47478
  • Total likes: 564
  • DansDeals.com Hat Tips 15685
  • Gender: Male
    • View Profile
  • Location: CLE
  • Programs: UA Global Services, AA Lifetime Plat, DL Dirt, SPG Plat, Hyatt Diamond, Fairmont Lifetime Plat, Hilton Diamond, Priority Club Plat, Avis Chairman, National EE, Hertz PC
I'll test it, how long until  you can see if you got anything from it? Is there a minimum item price?
Should see it by the next day. No minimum price.
Save your time, I don't answer PM. Post it in the forum and a dedicated DDF'er will get back to you as soon as possible.

Offline etech0

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Dec 2013
  • Posts: 8472
  • Total likes: 116
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
@etech0 I'd like to suggest 2 changes, 1) remove https:\/\/www. from the RegExp, this way it works if you have your Amazon auto redirect to smile.amazon.com like I do, and 2) remove all the repetetive var and semicolons from the variables and instead have them comma delimited, much cleaner and more correct :)

See my edits to your awesome code below:
Code: [Select]
javascript:(function(){
  var pattern = new RegExp("(amazon.com\/).*([dg]p\/)(?:product\/)?(..........).*", "i"),
      match = location.href.match(pattern),
      image = document.getElementById('landingImage').src,
      price = document.getElementById('priceblock_ourprice').innerHTML,
      URL = match[1] + "dp/" + match[3] +"/?tag=cl03f-20&smid=ATVPDKIKX0DER",
      result = "[url="+URL+"]"+document.title+" [b]("+price+")[/b][/url]\n\n[url="+URL+"][img]"+image+"[/img][/url]"; window.prompt("Press control-c",result); void(0);
})()
Cool! Will update wiki.
The question was if that negates Dan's referral code.
JoeyShmoe's code doesn't redirect smile to smile, so either way his code is good.
Workflowy. You won't know what you're missing until you try it.

Offline JoeyShmoe

  • Dansdeals Platinum Elite + Lifetime Gold Elite
  • ******
  • Join Date: Nov 2014
  • Posts: 952
  • Total likes: 33
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
  • Location: Lakewood
Should see it by the next day. No minimum price.
I just bought this, let us know if it shows up in your affiliate dashboard
DDF A-Z Link Extension
Chrome
Firefox
Info

Offline etech0

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Dec 2013
  • Posts: 8472
  • Total likes: 116
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
Workflowy. You won't know what you're missing until you try it.

Offline JoeyShmoe

  • Dansdeals Platinum Elite + Lifetime Gold Elite
  • ******
  • Join Date: Nov 2014
  • Posts: 952
  • Total likes: 33
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
  • Location: Lakewood
To further complicate things below is an updated version of the code. 2 differences from my previous code 1) it checks whether you're on smile.amazon.com or www.amazon.com and generates the appropriate link (should only be used once @Dan confirms that he gets commission on those links), 2) if your browser allows to copy via Javascript, it'll do so automatically, no need to Ctrl + c.

Code: [Select]
javascript:(function(){
  var pattern = new RegExp("(https:\/\/www.amazon.com\/).*([dg]p\/)(?:product\/)?(..........).*|(https:\/\/smile.amazon.com\/).*([dg]p\/)(?:product\/)?(..........).*", "i"),
      match = location.href.match(pattern),
      image = document.getElementById('landingImage').src,
      price = document.getElementById('priceblock_ourprice').innerHTML,
      URL = (match[1] !== undefined) ? match[1] + "dp/" + match[3] +"/?tag=cl03f-20&smid=ATVPDKIKX0DER": match[4] + "dp/" + match[3] +"/?tag=cl03f-20&smid=ATVPDKIKX0DER",
      result = "[url="+URL+"]"+document.title+" [b]("+price+")[/b][/url]\n\n[url="+URL+"][img]"+image+"[/img][/url]";
  if(document.execCommand('copy') !== false) {
    var ddLink = document.createElement('span'),
        range = document.createRange();
    ddLink.id = "ddLink";
    ddLink.innerText = result;
    document.body.appendChild(ddLink);
    range.selectNode(document.getElementById('ddLink'));
    window.getSelection().addRange(range);
    document.execCommand('copy');
    document.getElementById('ddLink').remove();
    setTimeout(function() {alert('DD link copied to clipboard...')}, 1000);
  } else {
    window.prompt("Press control-c",result);
  }
  void(0);
})()

Sorry, I enjoy playing with Javascript too much :)
DDF A-Z Link Extension
Chrome
Firefox
Info

Offline etech0

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Dec 2013
  • Posts: 8472
  • Total likes: 116
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
I just bought this, let us know if it shows up in your affiliate dashboard
@Dan any update on this?
Workflowy. You won't know what you're missing until you try it.

Offline Dan

  • Administrator
  • Dansdeals Lifetime 40K Presidential Platinum Elite
  • **********
  • Join Date: May 2008
  • Posts: 47478
  • Total likes: 564
  • DansDeals.com Hat Tips 15685
  • Gender: Male
    • View Profile
  • Location: CLE
  • Programs: UA Global Services, AA Lifetime Plat, DL Dirt, SPG Plat, Hyatt Diamond, Fairmont Lifetime Plat, Hilton Diamond, Priority Club Plat, Avis Chairman, National EE, Hertz PC
Save your time, I don't answer PM. Post it in the forum and a dedicated DDF'er will get back to you as soon as possible.

Offline JoeyShmoe

  • Dansdeals Platinum Elite + Lifetime Gold Elite
  • ******
  • Join Date: Nov 2014
  • Posts: 952
  • Total likes: 33
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
  • Location: Lakewood
Worked!
Nice! Now I can help 2 causes while I shop online!! What a world we live in!!
DDF A-Z Link Extension
Chrome
Firefox
Info

Offline stooges44

  • Dansdeals Presidential Platinum Elite
  • ********
  • Join Date: Jan 2017
  • Posts: 3027
  • Total likes: 112
  • DansDeals.com Hat Tips 110
    • View Profile

Offline Dan

  • Administrator
  • Dansdeals Lifetime 40K Presidential Platinum Elite
  • **********
  • Join Date: May 2008
  • Posts: 47478
  • Total likes: 564
  • DansDeals.com Hat Tips 15685
  • Gender: Male
    • View Profile
  • Location: CLE
  • Programs: UA Global Services, AA Lifetime Plat, DL Dirt, SPG Plat, Hyatt Diamond, Fairmont Lifetime Plat, Hilton Diamond, Priority Club Plat, Avis Chairman, National EE, Hertz PC
Nice! Now I can help 2 causes while I shop online!! What a world we live in!!
3 as DD gives tzedaka on earnings as well :)
Thanks for your support!
Save your time, I don't answer PM. Post it in the forum and a dedicated DDF'er will get back to you as soon as possible.