1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Amazon 90 Days cookie

Discussion in 'Resource and Add-on Requests' started by Andy.N, Jun 8, 2012.

  1. Andy.N

    Andy.N Well-Known Member

    There is an addon here that will automatically add your Amazon affiliate ID to any amazon link. It only gives anyone who use the link a 24 hours cookie. This means that you won't receive any commission if your visitors decide to buy it after 24 hours.

    However, you can change the affiliate link into direct shopping cart link that will have 90 days cookie.


    It would be great if anyone knows how to change the current addon to automatically change any copy and paste amazon link into a Add-to-Cart link.
    Phillip and Coop1979 like this.
  2. Chris D

    Chris D XenForo Developer Staff Member

    Am I correct in saying that this code:

    <form method="GET" action="http://www.amazon.com/gp/aws/cart/add.html"> <input type="hidden" name="AssociateTag" value="storeid-20"/> <input type="hidden" name="SubscriptionId" value="0EMJ6TWAXGX6JF1NP202"/> <input type="hidden" name="ASIN.1" value="B00003CWT6"/><br/> <input type="hidden" name="Quantity.1" value="1"/><br/> <input type="image" name="add" value="Buy from Amazon.com" border="0" alt="Buy from Amazon.com" src="http://images.amazon.com/images/G/01/associates/add-to-cart.gif"> </form> 
    Basically adds a button which when clicked takes you to product B00003CWT6. If you add it to your cart, then a cookie is set for 90 days which provides commission to this user: storeid-20 if it is purchased any time within that 90 days?

    Hmm... sounds good. Let me take a look at the original code.
  3. RobParker

    RobParker Well-Known Member

    Is that if only that item is purchased or any item?
  4. Chris D

    Chris D XenForo Developer Staff Member

    This can be achieved with BB Code Media Sites.

    I'm not sure how it would play with the original add-on, Andy, but for testing purposes I'd suggest you disable it if you want to try this.

    Download the attached file, extract the contents and install the add-on using the provided XML file in the Admin CP.

    There are no files to upload.

    We can change the output as necessary, but anyone who posts an Amazon.com product URL such as:


    Will automatically have their URL converted into an Amazon buy now button. You may not want a big yellow amazon button, but this is the code they provided and this is just a proof of concept really. The above URLs in the same post will render like this:

    amazon affiliates.PNG

    You will need to add your own Affiliate ID by going to, Admin CP > BB Code Media Sites > Amazon and in Embed HTML find storeid-20 and replace that with your Amazon affiliate ID.

    Attached Files:

    RobinHood and Andy.N like this.
  5. Andy.N

    Andy.N Well-Known Member

    Great job Yorick
    Very impressive that you came up with the solution overnight.
    You are right, the yellow big button won't do. I see that the code they provide can be styled differently. Can we just display the link or item title instead?
    Many thanks
  6. Andy.N

    Andy.N Well-Known Member

    Btw, when i go to BB Code Manager -> Import new BB code and import the XML, it will result in a blank page.
  7. Chris D

    Chris D XenForo Developer Staff Member

    It's nothing to do with BB Code Manager.

    Install it like a normal add-on.

    It's actually a BB Code Media Site - just like YouTube, Vimeo etc. that is included in the XenForo core. That XML adds Amazon as one of those.

    Just going to check out the output as we don't need the button. Displaying the product title is more challenging and would require a separate add-on that would go and fetch the product name or the page title (not impossible). I will initially get it working to display the URL, though.
    RobinHood and Andy.N like this.
  8. Andy.N

    Andy.N Well-Known Member

    There is an existing addon from ragtek that change url to title.
    If would be enough if we can display the url the users enter.
  9. Chris D

    Chris D XenForo Developer Staff Member

    There's a fundamental problem with the way that this code works.

    It's a HTML form and the way it takes you to the product is via an input button. We aren't going to be able to make this work the way we'd like.

    What we need to know is, what exactly generates the 90 day cookie? Is it ONLY this form code? Or is there other widgets and code available that also leave a 90 day cookie? Ideally we'd be looking for something that allows us to convert any Amazon.com link, not into a HTML form like this but, into a standard URL that has all of the relevant affiliate IDs in it. If we can find that, then that'll be loads better.
  10. Andy.N

    Andy.N Well-Known Member

    Yes. It seems you only get 90 days cookie if you put them in your shopping cart.
  11. Chris D

    Chris D XenForo Developer Staff Member


    I've just created an affiliate account so I am going to investigate what kind of thing we can do.

    So if I read this right, and from a bit of research I've done - as long as they end up on the cart page by clicking "Continue" the 90 day cookie is set.... Sounds good.
    Andy.N likes this.
  12. Chris D

    Chris D XenForo Developer Staff Member

  13. Andy.N

    Andy.N Well-Known Member

    Yorick likes this.

Share This Page