Simple Machines Community Forum

Customizing SMF => Bridges and Integrations => Topic started by: SlyBaldGuy on January 07, 2019, 01:45:28 AM

Title: Converting words and phrases to affiliate links and other links with CouchMoney
Post by: SlyBaldGuy on January 07, 2019, 01:45:28 AM
For nearly 10 years I was using a PHP application that converted words and phrases to affiliate links on my SMF forum and it worked really well to boost my affiliate revenue, especially Amazon affiliate revenue.

About a year ago the script stopped working because of changes with MYSQL and the developers had abandoned the script so I couldn't use it anymore.  After a year-long search, I'm happy to say that I found a solution that is working for me and is actually much easier to use than my previous script. It's called CouchMoney (https://couchmoney.net) and after testing it for a few weeks, it's working like a charm.

Though, if you decide to use it, make sure you install the </head> and </body> custom mod (https://www.simplemachines.org/community/index.php?topic=394952.0) to make it easier to install on your site. If you try to place it directly in the index.template file then you'll need to modify the javascript to work.
Title: Re: Converting words and phrases to affiliate links and other links with CouchMoney
Post by: SlyBaldGuy on January 07, 2019, 01:51:56 AM
If you do want to paste it directly into your template file, use this code:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>

<script>
      $.ajax({
          url: "https://couchmoney.net/api/1.1/obj/script?constraints=%5B%7B%20%22key%22%3A%20%22websiteid%22%2C%22constraint_type%22%3A%20%22equals%22%2C%22value%22%3A%20%22[Your Website ID]%22%7D%2C%7B%22key%22%3A+%22valid%22%2C%22constraint_type%22%3A+%22equals%22%2C%22value%22%3A+%22yes%22%7D%5D",
          success: function(data){
            $str = \'\';
            $str = (data[\'response\'].results[0][\'script\']);
            $str = $str.replace("\n", "", "g");
            var F=new Function ($str);
            return(F());
          }
        });
</script>