1. Help Centre
  2. Getting Started

Feed Ads Api Documentation

How To Get the Feed Data

Creatives linked to a Feed can access the Feed data using the Adnami Ads API v1. The Ads API provides a convenience function getFeedDataResult() for easily querying any Feed data available in the Creative. The function finds and then parses JSON data from the script tag with the ID "adnm_proprietary_feed_data_json".

 

Example of how the function is used

if(window.__adnamiAdsAPI && window.__adnamiAdsAPI.v1 && window.__adnamiAdsAPI.v1.creativeConfigurator)
{
let feedData = window.__adnamiAdsAPI.v1.creativeConfigurator.getFeedDataResult();
}

 

The function returns an object of the below structure

{
errorMessage: "some-error-message-here",
feedData: {
items: [
{
attribute1: val1,
attribute2: val2
},
{
attribute1: val3,
attribute2: val4
}
]
}
};

Error

If the errorMessage attribute has a value it means something went wrong and the feedData will be null. 

Possible error cases are:

  • The script tag containing the JSON was not found
  • The script tag is empty
  • The json in the script tag is malformed
  • The script tag contains an empty array of items

Zip file for testing

You can use this zip file as the banner in a Creative. It will print the feed data in a table for you to inspect.

A Google Sheet looking like this . . .

Screenshot 2023-08-10 at 14.31.01

Turns into this. . .