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.
	
	
	
		
How  to install it
1. Go to google sheets, extensions, app script and copy paste it. Edit it to fit
	
		
			
		
		
	
				
			
		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}`);
    }
   });
}1. Go to google sheets, extensions, app script and copy paste it. Edit it to fit
 
				


 
 
		 
			 
 
		
 
 
		 
 
		