Setup Product Feeds for Dynamic Creative

Dynamic Creative enables personalized ads across devices on Web and Facebook. Dynamic ads can feature previously-viewed, recommended, and top products. Product details are populated via product feeds you host on your server. This guide shows you how to setup and configure a product feed using the AdRoll API.

To better familiarize yourself with Dynamic Creative, you should also read the getting started guide and the product feed guidelines on the AdRoll Help Center.

Register a Product Feed

First you must register a product feed. Product feeds must be a public URL that AdRoll can periodically crawl. The feed can be in any of the following formats: CSV, JSON, or XML. At a minimum the feed must contain the following details for each product:

  • Product ID
  • Product title
  • Destination URL
  • Image URL

If you you already have a feed of your products, you shouldn’t need to create a feed specific to AdRoll. If your feed is in a standard format you can use the automatic setup. If your feed is a custom format, you should follow the manual setup instructions.

Note

If you have multiple product feeds, repeat the setup process for each feed. The products in the feed will be combined into one catalog. If you have multiple feeds with different purposes (i.e. product groups, language specific, region specific), send us a message and we should be able to accommodate you.

Automatic Setup

If your product feed uses the Google Products Feed (aka Google Base) format, you can use the enable_rollcrawl method to automatically setup and configure your feed.

POST /api/v1/advertisable/enable_rollcrawl

Parameters:

  • advertisable (string) - EID of the advertisable to add the feed
  • url (string) - URL of the feed

Manual Setup

If you can’t use automatic setup for your feed, then you’ll need to manually configure a feed.

The data model is as follows:

  • Each Advertisable has one RollCrawl Configuration
  • Each RollCrawl Configuration has one or more Feed Configuration
  • Each Feed Configuration has four or more Parser Configurations (i.e. one per field in the feed)

Add a Feed Configuration

First you’ll need to register a new product feed. To do this, you make a call to rollcrawl_configuration/add_feed_config.

POST /api/v1/rollcrawl_configuration/add_feed_config

Parameters:

  • advertisable (string) - Advertisable that the feed belongs to
  • feed_url (string) - URL of the feed
  • feedtype (enum) - Data format used in the feed: auto, csv, xml, json
  • skipfirstrow (boolean) - True if the CSV contains a header row that should be skipped
  • delimiter (string) - Field delimiter used for CSV feeds
  • escapechar (string) - Escape character used for CSV feeds
  • quotechar (string) - Quote character used for CSV feeds
  • skipinitialspace (boolean) - True if the parser should ignore whitespace after the delimiter character in CSV feeds
  • encoding (string) - File encoding used by the feed
  • tag_name (string) - XML element containing product info
  • locale (string) - Cultural locale of the data defaults to en_US
  • prices_in_locale_format (boolean) - True if the price field contains a locale character (i.e. $)

Add Parser Configurations

Once you’ve registered a product feed, you need to tell AdRoll which fields to parse. This is done with the feed_config/set_parser_configs method. You’ll need to specify a Parser Configuration for each field. Since we require a minimum number of fields, you’ll have to configure at least four Parser Configurations. Any additional fields will depend on the Dynamic Creative template you’re using.

POST /api/v1/feed_config/set_parser_configs

Parameters:

  • feed_config (string) - ID of the Feed Configuration object
  • parser_configs (string) - Stringified JSON object defining configuration for each field

The parser_configs parameter consists of an object of fields names as keys and field specification objects consisting of the following attributes:

  • is_required (boolean) - True if this field is required for the parsed product to be valid
  • path (string) - Column number (CSV), field name (JSON), or tag name (XML) for the field
  • attribute (string) - Attribute on the tag to use (i.e. text)
  • regular_expression (string) - Regular expression to search the field
  • regular_expression_replace (string) - Replacement string to apply to the field
  • type (string) - Field type (either text, image, price)

Example parser_configs object:

{
  "id": {
    "path": "id",
    "type": "text",
    "attribute": "text",
    "is_required": "true"
  },
  "title": {
    "path": "title",
    "type": "text",
    "attribute": "text",
    "is_required": "true"
  },
  "image": {
    "path": "image",
    "type": "image",
    "attribute": "text",
    "is_required": "true"
  },
  "url": {
    "path": "url",
    "type": "text",
    "attribute": "text",
    "is_required": "true"
  },
  "price": {
    "path": "price",
    "type": "price",
    "attribute": "text",
    "is_required": "true"
  }
}

Capture product views

Setup rules to capture product views so we know which ads have been viewed. The product ID can be retrieved from either of these sources:

The second two are configured using the below API method.

POST /api/v1/rollcrawl_configuration/edit

Parameters:

  • product_id_from_page_scheme (string) - Where to grab the product ID from (i.e. url or html)
  • product_id_from_page_attribute (string) - Attribute to retrieve the tag from (i.e. text)
  • product_id_from_page_regular_expression (string) - Regular expression used to match the product ID (i.e. products/([^?]+))
  • product_id_from_page_path (string) - HTML tag that contains the SKU
  • product_id_from_page_regular_expression_replace
  • product_group_from_page_scheme
  • product_group_from_page_attribute
  • product_group_from_page_path
  • product_group_from_page_regular_expression
  • product_group_from_page_regular_expression_replace

Response:

Feed Configuration object

For example, To find find the product ID in the page that looks like:

sku = "Test12434"

You would use the following parameters:

product_id_from_page_scheme='html'
product_id_from_page_path='html'
product_id_from_page_attribute='text'
product_id_from_page_regular_expression=sku = "(\S+)"'
product_id_from_page_regular_expression_replace='\1'