Your JSON Feed URL:
Tracking Domain:
www.cpagrip.com (Default)
JSON Offer Feed Variable Information & Examples
The JSON Offer Feed is a great way to integrate you own offer display system with our network. Below your will find a list of url request variables and their descriptions along with an example PHP script showing you how to use this tool for a virtual currency display.
JSON Feed URL Variables:
| Variable | Description | Examples |
Required |
| &user_id= | This is your affiliate id and is required to process your offer feed. | 2549038 | *Required |
| &pubkey= | This is your public access key and is required to process your offer feed. | 282e000b6625e4bc93d74d33e95efd67 | *Required for client-side integration |
| &key= | This is your unique private access key and is required to process your offer feed. | dfc18a047ae9a7b5dbdb99f6bf82ebde | *Required for extended results |
| &ip= |
This is the ip address of your visitor that you want to show the offers to. It's important that we know the ip address of your visitor so we can display the proper offers for their country.
Note: If this variable is blank then the ip of the machine making the JSON request will be used instead. |
102.211.146.47 | Optional |
| &lid= | Locker ID. Passing a locker ID will enable all customized offer settings associated with the locker on this feed. Only available when using your public access key. | 123456 | Optional Requires public key Compatable with view recording |
| &tracking_id= | Tracking ID of the user that is going to complete an offer. This could be a users id, email address, or unique username. | 812947, email@website.com, simon123 | Optional |
| &ua= |
User Agent of your user. By collecting the user agent, we can automatically determine if web or mobile offers should be displayed.
Note: The user agent will be automatically detected if you are using web browser jquery/javascript and not server side code. |
Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0 | Optional |
| &limit= | Maximum number of offers to display in RSS. | 5 | Optional Compatable with view recording |
| &domain= | This option sets the doman used for offer links provided it is a valid vanity domain. | singingfiles.com, doctoredits.com, tundrafile.com | Optional |
| &showmobile= | This option (when set as yes, true or 1) will include mobile offers in your json feed, or only mobile offers when set to 'only'. | {blank}, yes, true, 1, only | Optional Requires private key Not compatable with view recording |
| &showall= |
This option (when set as yes, true or 1) will include all geos and capped offers in your json feed.. Can be combined with 'showmobile' and 'country' to limit scope while still returning capped offers. |
{blank}, yes, true, 1 | Optional Requires private key Not compatable with view recording |
| &country= | This option accepts a two character country code to restrict offers in your json feed to one specific country. | {blank}, US, GB | Optional Requires private key Not compatable with view recording |
| &offer_type= |
This option accepts text to restrict offers in your json feed to one specific type of offer. |
{blank}, 'Email/Zip Submit', 'Pin-Submit', 'Credit Card Submit', 'Mobile Install' | Optional Compatable with view recording |
| &callback= |
This option wraps the JSON data in a JSONP function call so it can be included via script tag instead of ajax call |
{blank}, any valid JavaScript user defined function name | Optional Compatable with view recording |
| Variable | Required |
| &user_id= | *Required |
| This is your affiliate id and is required to process your offer feed. | |
| 2549038 | |
| &pubkey= | *Required for client-side integration |
| This is your public access key and is required to process your offer feed. | |
| 282e000b6625e4bc93d74d33e95efd67 | |
| &key= | *Required for extended results |
| This is your unique private access key and is required to process your offer feed. | |
| dfc18a047ae9a7b5dbdb99f6bf82ebde | |
| &ip= | Optional |
|
This is the ip address of your visitor that you want to show the offers to. It's important that we know the ip address of your visitor so we can display the proper offers for their country.
Note: If this variable is blank then the ip of the machine making the JSON request will be used instead. |
|
| 102.211.146.47 | |
| &tracking_id= | Optional |
| Tracking ID of the user that is going to complete an offer. This could be a users id, email address, or unique username. | |
| 812947, email@website.com, simon123 | |
| &lid= | Optional Requires public key Compatable with view recording |
| Locker ID. Passing a locker ID will enable all customized offer settings associated with the locker on this feed. Only available when using your public access key. | |
| 123456 | |
| &ua= | Optional |
|
User Agent of your user. By collecting the user agent, we can automatically determine if web or mobile offers should be displayed.
Note: The user agent will be automatically detected if you are using web browser jquery/javascript and not server side code. |
|
| Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0 | |
| &limit= | Optional Compatable with view recording |
| Maximum number of offers to display in RSS. | |
| 5 | |
| &domain= | Optional |
| This option sets the doman used for offer links as provided as it is a valid vanity domain. | |
| singingfiles.com, doctoredits.com, tundrafile.com | |
| &showmobile= | Optional Requires private key Not compatable with view recording |
| This option (when set as yes, true or 1) will include mobile offers in your json feed, or only mobile offers when set to 'only'. | |
| {blank}, yes, true, 1, only | |
| &showall= | Optional Requires private key Not compatable with view recording |
|
This option (when set as yes, true or 1) will include all geos and capped offers in your json feed.. Can be combined with 'showmobile' and 'country' to limit scope while still returning capped offers. |
|
| {blank}, yes, true, 1 | |
| &country= | Optional Requires private key Not compatable with view recording |
| This option accepts a two character country code to restrict offers in your json feed to one specific country. | |
| {blank}, US, GB | |
| &offer_type= | Optional Compatable with view recording |
|
This option accepts text to restrict offers in your json feed to one specific type of offer. |
|
| {blank}, 'Pin-Submit', 'Mobile Install', 'Free Survey' | |
| &callback= | Optional Compatable with view recording |
|
This option accepts text to restrict offers in your json feed to one specific type of offer. |
|
| {blank}, any valid JavaScript user defined function name | |
Jquery/Javascript Example: (examples apply for your web pages.)
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> </head> <div class="offer_holder">Loading Offers..</div> <script type="text/javascript"> $(function() { $.getJSON("https://www.cpagrip.com/common/offer_feed_json.php?user_id=2549038&pubkey=282e000b6625e4bc93d74d33e95efd67", function(json_data){ var offer_text = ''; $.each(json_data.offers, function(key, offer){ //lets use a custom tracking domain for the links :) offer.offerlink = offer.offerlink.replace('www.cpagrip.com','motifiles.com'); offer_text += '<a href="'+offer.offerlink+'" target="_blank" class="offer_item">'+offer.title+'</a><br/>'; }); $(".offer_holder").html(offer_text); }); }); </script> </html>
PHP/JSON Example: (examples apply for your PHP web server.)
<?php $tracking_id = 'user@gmail.com'; //This is used to track the user doing the offer. can be email, clickid, subid.. etc $max_offers = 30; //max number of offers to retrieve. $feedurl = 'https://www.cpagrip.com/common/offer_feed_json.php?user_id=2549038&key=dfc18a047ae9a7b5dbdb99f6bf82ebde&limit='.$max_offers.'&tracking_id='.urlencode($tracking_id).'&domain=filetrkr.com&showall=true'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $feedurl); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // get the result of http query $output = curl_exec($ch); curl_close($ch); $json = @json_decode($output); if(isset($json->offers)) { foreach($json->offers as $offeritem) { //leave uncommented below if you want to display a point value. $points = floatval($offeritem->payout) * 100; //lets make offers worth $1.20 appear as 120 points. echo '<strong>Point Value: '.$points.' Points</strong><br/>'; //display where offer accepts traffic from: echo '<strong>Country '.$offeritem->accepted_countries.'</strong><br/>'; echo '<a target="_blank" href="'.$offeritem->offerlink.'">'.$offeritem->title.'</a><br/>'; //uncomment to show offers description //echo $offeritem->description.'<br/>'; //uncomment to show offers image //echo '<img src="'.$offeritem->offerphoto.'">'; echo '<br/>'; } if(count($json->offers)==0){ echo 'Sorry there are no offers available that match your request at this time.'; } }else{ echo 'error fetching json offer feed: '. $output; } ?>
CPAGrip A.I. Assistant