Mobidea
Unlock 9,000+ direct and exclusive offers, Weekly payouts, and VIP support! Don’t miss out, supercharge your affiliate success today!

Google Sheets script that could help you

Wallester

Plamen

Super Contributor
Joined
Sep 23, 2020
Messages
32
Hello, I made a script that can send api call to a network, take offers, and paste them in a Google sheet file so you can easialy compare and choose offer to promote. Script can be adjust in a way you need.

JavaScript:
function  myFunction() {
  const countries =  ['US', 'CA', 'GB', 'DE', 'AU', ];  // You can update this as  needed

  const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
   sheet.clear(); // Optional: clears previous  data
  sheet.appendRow(['Offer ID', 'Name', 'Payout',  'Country', 'Net Epc', 'Category']); // Headers

   countries.forEach(function(country) {
     const url = `https://www.cpagrip.com/common/offer_feed_json.php?user_id=xxxx&key=xxxxxxx&country=${country}&limit=100`;

     try {
       const response = UrlFetchApp.fetch(url);
       const  result = JSON.parse(response.getContentText());
       const {offers} = result;
       if  (offers.length < 1) {
         return;
       }
       offers.forEach(function(offer)  {
         const payout = parseFloat(offer.payout);
          if (parseFloat(offer.netepc) >= 0.1 &&  parseFloat(offer.payout) > 1.2) {
            sheet.appendRow([
              offer.offer_id,
              offer.title,
              parseFloat(offer.payout),
              offer.accepted_countries,
              parseFloat(offer.netepc),
              offer.category
           ]);
          }
       });
    }  catch (err) {
       Logger.log(`Error fetching offers for  ${country}: ${err}`);
    }
   });
}
How to install it
1. Go to google sheets, extensions, app script and copy paste it. Edit it to fit
 

Attachments

  • Screenshot 2025-04-11 at 18.46.01.png
    Screenshot 2025-04-11 at 18.46.01.png
    231.4 KB · Views: 121
To view the premium content in our affiliate marketing forum (including this awesome thread), you must first register and upgrade your account. Register today and become a part of our amazing community!

More awesome affiliate marketing threads 👇

Top