API

Moments API

the moments api (previously native ads api) allows publishers to easily integrate offers within their app or website using any language that supports the ability to make restful calls quickstart the typical flow to generate and serve offers is as follows api docid\ fdwu3w abztbbfv5jhhqk make a fetch offers api call to adspostx to retrieve offers parse the response and display offers in the desired fashion ensure that beacon urls fire on sequence and offer impression loads fetch offers method post base url https //api adspostx com/native/v2/offers json header parameters parameter description type example content type required required should be application/json string application/json query parameters parameter description type example api key required required your api key api docid\ fdwu3w abztbbfv5jhhqk required permission ads/offers string 4bbdefc2 b130 424d 8170 54bdcb98e64e loyaltyboost optional include loyaltyboost offers in response; values 0 = none 1 = true 2 = only string 0 | 1 | 2 creative optional returns offers with at least one creative (image) if set to true string 0 | 1 body parameters parameter description type example ua recommended recommended the user agent of the end user required for proper targeting if proxying requests via a server call, be sure to pass through the user agent of the end user string mozilla/5 0 (linux; android 10; k) applewebkit/537 36 (khtml, like gecko) chrome/120 0 6099 43 mobile safari/537 36 ip recommended recommended ip address of the end user to be passed through used for targeting string adpx fp recommended recommended a unique identifier for the end user; not required but highly recommended more information can be found below string dev optional returns a test response ignores geo restrictions no activity is recorded string 0 | 1 \<string> optional custom key value payload attributes you can add any number of custom key value payload attributes to the payload that you want to use to add additional details all payload attributes are passed back on conversion reports and can be reported on in relation to impression and clicks string membershipid "a45gre987343pkd" the adpx fp attribute in the body of the fetch offers call is a special parameter that aids in overall offer performance it should be populated with a unique end user identifier as an alpha numeric string adspostx uses the adpx fp value to frequency cap offers on a unique user basis as well as exclude offers from showing again when a user opts out for a certain offer note that the number of offers is controlled by the configuration settings in your publisher dashboard log into your dashboard, click on settings > configuration from the side menu and then select the number of offers you would like to have returned the response body upon a successful response from the fetch offers api request, the body of the reponse will include a data object that contains an array of objects that can be used to construct your offers sample response response example { "data" { "offers" \[ { "id" 4359, "title" "you unlocked adspostx for 90 days free!", "description" "adspostx lets you capture revenue across your user's moments delight your users with relevant offers at the right time get 3 months free!", "click url" "https //trk pubtailer com/sdk/offer click?o id=4359\&c id=1649\&p id=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e", "image" "https //adpx b cdn net/campaigns/1649/62a98d93af4e12a3dbbcf247172fadce png", "mini text" "", "pixel" "https //trk pubtailer com/sdk/v2/impression/p png?o id=4359\&c id=1649\&p id=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e\&cbuster=%7bcbuster%7d", "cta yes" "try out adspostx!", "cta no" "no, thanks", "useraction cta" "", "useraction url" "", "adv pixel url" "", "beacons" { "close" "https //trk pubtailer com/event/record/close?oid=4359\&cid=1649\&pid=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e", "no thanks click" "https //trk pubtailer com/event/record/no thanks click?oid=4359\&cid=1649\&pid=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e" }, "creatives" \[ { "id" 1436, "url" "https //adpx b cdn net/campaigns/1649/62a98d93af4e12a3dbbcf247172fadce png", "height" 1530, "width" 1530, "type" "png", "is primary" true, "aspect ratio" 1 } ], "offerwall enabled" true, "short description" "capture revenue across your user's moments get 3 months free!", "short headline" "3 free months of adspostx!", "advertiser name" "adspostx", "is loyaltyboost" false, "loyaltyboost requirements" "" }, { "id" 4586, "title" "you unlocked adspostx for 90 days free!", "description" "adspostx lets you capture revenue across your user's moments delight your users with relevant offers at the right time get 3 months free!", "click url" "https //trk pubtailer com/sdk/offer click?o id=4586\&c id=1879\&p id=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e", "image" "https //adpx b cdn net/campaigns/1879/d93fbd2662b784b655d430c9ce3789e4 png", "mini text" "", "pixel" "https //trk pubtailer com/sdk/v2/impression/p png?o id=4586\&c id=1879\&p id=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e\&cbuster=%7bcbuster%7d", "cta yes" "earn 150 points", "cta no" "no, thanks", "useraction cta" "", "useraction url" "", "adv pixel url" "", "beacons" { "close" "https //trk pubtailer com/event/record/close?oid=4586\&cid=1879\&pid=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e", "no thanks click" "https //trk pubtailer com/event/record/no thanks click?oid=4586\&cid=1879\&pid=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e" }, "creatives" \[ { "id" 1769, "url" "https //adpx b cdn net/campaigns/1879/d93fbd2662b784b655d430c9ce3789e4 png", "height" 1530, "width" 1530, "type" "png", "is primary" true, "aspect ratio" 1 } ], "offerwall enabled" true, "short description" "capture revenue across your user's moments get 3 months free!", "short headline" "3 free months of adspostx!", "advertiser name" "adspostx", "is loyaltyboost" true, "loyaltyboost requirements" "user must finish integrating adspostx to qualify you must click “allow” if tracking permission is requested within the app " }, { "id" 5043, "title" "click to unlock adspostx for 90 days free!", "description" "adspostx lets you capture revenue across your user's moments delight your users with relevant offers at the right time get 3 months free!", "click url" "https //trk pubtailer com/sdk/offer click?o id=5043\&c id=2338\&p id=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e", "image" "https //adpx b cdn net/campaigns/1649/62a98d93af4e12a3dbbcf247172fadce png", "mini text" "", "pixel" "https //trk pubtailer com/sdk/v2/impression/p png?o id=5043\&c id=2338\&p id=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e\&cbuster=%7bcbuster%7d", "cta yes" "try out adspostx!", "cta no" "no, thanks", "useraction cta" null, "useraction url" null, "adv pixel url" "", "beacons" { "close" "https //trk pubtailer com/event/record/close?oid=5043\&cid=2338\&pid=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e", "no thanks click" "https //trk pubtailer com/event/record/no thanks click?oid=5043\&cid=2338\&pid=1854\&sess id=51267da82f8e1a6c2900c5c051c1648a63f8410e" }, "creatives" \[ { "id" 2741, "url" "https //adpx b cdn net/campaigns/1649/62a98d93af4e12a3dbbcf247172fadce png", "height" 1530, "width" 1530, "type" "png", "is primary" true, "aspect ratio" 1 } ], "offerwall enabled" true, "short description" "capture revenue across your user's moments get 3 months free!", "short headline" "3 free months of adspostx! click to unlock", "advertiser name" "adspostx", "is loyaltyboost" false, "loyaltyboost requirements" "" } ], "count" 3, "privacy url" "https //www adspostx com/privacy policy" } } response parameters upon making an api call, the following attributes are returned in the response to construct your offers with offers array of offer objects contains the copy, creatives, and resources to construct each offer each offer object has the following attributes offer attributes offers\[] title string recommended to implemen recommended to implemen t for larger formats t for larger formats the title of the offer to be used to construct the headline of the offer maximum length 90 characters offers\[] advertiser name string the name of the advertiser offering the offer offers\[] description string recommended to implemen recommended to implemen t for larger formats t for larger formats the description of the offer maximum length 220 characters offers\[] click url url required to implement required to implement url the offer should direct to offers\[] image url recommended to implement recommended to implement url for the offer's primary image offers\[] mini text string recommended to implement recommended to implement additional sub description for the offer used for disclaimers maximum length 160 characters offers\[] pixel url required to implement required to implement the impression beacon url to be fired when the offer is displayed to the user for impression tracking a successful get call to the pixel url is required to successfully record delivery on the adspostx dashboard offers\[] cta yes string recommended to implement recommended to implement suggested copy for implementing a postitive cta button for the user to accept the offer maximum length 25 characters offers\[] cta no string recommended to implement recommended to implement suggested copy for implementing a negative cta button for the user to reject an offer maximum length 25 characters offers\[] adv pixel url url required to implement if available required to implement if available advertiser may provide their own impression tracking url, fire this along with the pixel impression beacon url a successful get call to adv pixel url is required offers\[] beacons object contains beacon urls for a variety of actions the beacons object contains the following attributes attribute type description offers\[] beacons close url to be fired when closer closes the offer container or when the user has browsed through all available offers for reporting purposes a successful get call to beacons close is required if implemented recommended to implement recommended to implement if offers are presented in a dismissable container if offers are presented in a dismissable container offers\[] beacons no thanks click url to be fired when user clicks the negative cta element for reporting purposes a successful get call to beacons no thanks clicks is required if implemented recommended to implement recommended to implement if a negative cta is implemented if a negative cta is implemented offers\[] creatives array of creative objects contains additional creative images that can be used to construct the offers unit each creative object contains the following attributes attribute type description offers\[] creatives\[] url url url location for the creative offers\[] creatives\[] height double height of the image in pixels offers\[] creatives\[] width double width of the image in pixels offers\[] creatives\[] type string file type of the image offers\[] creatives\[] is primary boolean indicates whether the image is primary or not offers\[] creatives\[] aspect ratio number the aspect ratio of the image a value of 1 = square image a value < 1 signifies generally portrait a value > 1 signifies generally landscape offers\[] short description string recommended to implemen recommended to implemen t for smaller formats t for smaller formats alternative shorter text to use for the offer's description if the context of the offer is in a smaller format like on mobile or if you're implementing the offer in a smaller element maximum length 140 characters offers\[] short headline string recommended to implemen recommended to implemen t for smaller formats t for smaller formats alternative shorter text to use for the offer's headline if the context of the offer is in a smaller format like on mobile or if you're implementing the offer in a smaller element maximum length 60 characters offers\[] is loyaltyboost boolean indicates if an offer is eligible to be used in an incentive manner offers\[] loyaltyboost requirements string specifies the requirements for a loyaltyboost offer it outlines the actions for which rewards will be granted to users these requirements define the criteria that the user must meet to qualify for rewards associated with the loyaltyboost offer maximum length 160 characters count integer number of offers returned from the call privacy url url recommended to implement recommended to implement url to adspostx's current end user privacy policy page parsing the response and displaying offers upon a successful response from the fetch offer's api request, generate offers using the offer fragments provided for each returned offer remember to implement impression tracking using the pixel attribute for each displayed offer a successful get call to the pixel url is required to successfully record delivery on the adspostx dashboard this allows adspostx to accurately calculate and present performance statistics such as click through rate (ctr), ecpm and other metrics use performance data to optimize ad delivery on future traffic generate and display first offer using the fragments of the offer returned in the response implement the impression beacon url ( pixel ) for the first offer if user engages with the negative call to action, implement the negative cta beacon url ( no thanks click ) r ender the second offer (and implement the impression beacon url for this offer ) continue through the sequence based on user engagement using creatives when retrieving offer , we provide a creatives attribute with each returned offer , which lists creatives available for use in your offers included with each creative is an is primary boolean attribute you can use any of the creatives available depending on the platform you are rendering or default to the primary creative if you are unsure the moments api also supports on the fly image transformations by simply adding the query parameter "width=xxx" into the image url (replace xxx with a suitable integer value for width, depending on the device resolution) the query parameters "height=xxx" or "?aspect ratio=x\ y" are also available as on the fly image processing directives on images we also provide an aspect ratio attribute for each creative which can be helpful in selecting an image for the offer an aspect ratio with a value of 1 = square image a value < 1 signifies generally portrait a value > 1 signifies generally landscape implementing event beacons in addition to tracking impressions, the offers response also provides a beacons object, containing the tracking urls for events no thanks click (to be fired when user clicks the negative cta element) and close (to be fired when user closes the offer container or when the user has browsed through all the available offers )