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

Wordpress - How do I convert all amazon links to affiliate links?

Discussion in 'Blogging' started by freezeice04, Sep 13, 2014.

  1. freezeice04

    freezeice04 Power Member

    Joined:
    Jul 5, 2010
    Messages:
    675
    Likes Received:
    286
    Location:
    AU
    How do I convert all amazon links to the affiliate link version? Is there a plugin to do this automatically?
     
  2. Rizzoli

    Rizzoli Registered Member

    Joined:
    Dec 28, 2012
    Messages:
    83
    Likes Received:
    14
    Occupation:
    Freelancer
    Location:
    DZ
    I am sure there are plugins for that, also not specific to amazon affiliate, i am using a plugin from codecanyon called amazon estore.
     
  3. SEO Power

    SEO Power Elite Member

    Joined:
    Jul 14, 2014
    Messages:
    2,637
    Likes Received:
    681
    Occupation:
    Self employed
    Location:
    Houston, TX
    You have to edit each post manually and generate the affiliate link for each product you are promoting. Then insert them manually.
     
  4. Schvamp

    Schvamp Power Member

    Joined:
    Feb 13, 2012
    Messages:
    684
    Likes Received:
    549
    Location:
    Hogwarts
    Nonsense..

    Add this to functions.php, replace fashionchicks-20 with your affiliate ID.
    This way you can easily change the ID later across all your links. I haven't tested it live yet but it should do the job.
    Note: this is for posts, and not sidebars etc.
    Code:
    add_filter('the_content', 'amazon_affiliate');
    function amazon_affiliate($url) {
        $affiliate_ID = "fashionchicks-20";
            $url = preg_replace("/http:\/\/[^>]*?amazon.(.*)\/([^>]*?ASIN|gp\/product|exec\/obidos\/tg\/detail\/-|[^>]*?dp)\/([0-9a-zA-Z]{10})[a-zA-Z0-9#\/\*\-\?\&\%\=\,\._;]*/i","http://www.amazon.$1/dp/$3/?tag=".$affiliate_ID,$url );
    return $url; 
    }
    
     
    • Thanks Thanks x 1
    Last edited: Sep 14, 2014
  5. supacatt

    supacatt Junior Member

    Joined:
    Mar 21, 2009
    Messages:
    111
    Likes Received:
    4
    Occupation:
    Internet Marketer
    Location:
    Hollywood, Florida
    I think EasyAzon may be able to do that also.
     
    • Thanks Thanks x 1