Welcome‎ > ‎

Dynamic Ads

Dynamic ads can be used to promote your offers across your internet properties.  There's two ways to create dynamic ads: the first uses the GC API directly, and the second takes advantage of the Group Commerce adserver

If you want to use complicated logic or do something very custom, calling the Broadcast API directly is a good choice.  Here you'd make a serverside (or jsonp) call to the Group Commerce Broadcast API to get back a list of offers, and then manipulate the json/xml that gets returned however you like to achieve your desired behavior.

The second, possibly simpler approach is to use the Group Commerce adserver to serve your dynamic ads.  Ad Units are defined in Group Commerce's Publisher Admin using a combination of HTML and some variable substitution syntax.  The Ad Server combines this HTML with the offers in the Publisher Admin to generate the final outputted HTML ad.  In the sections below, we'll dive deeper into this approach.

Variable substitution:
When building an Ad Unit in the Publisher Admin, any data that will be dynamically generated by the Ad Server based on the offer being advertised requires variable substitution.  In other words, when building an Ad Unit, you need a way to insert data from the offer being advertised, such as the Offer Title, Description, etc. inside the HTML -- this data will only be known to the Ad Server after it selects the offer to display in the ad.  The way you identify which field to insert into a specific area of an Ad Unit is via variable substitution.

The variables available for variable substitution generally match the properties of the Broadcast Offer Data Structure. The base offer object contains all properties eligible for substitution.

<#= offer.headline #>
<#= offer.locations[0].city #>
<#= offer.url #>
<#= offer.images[0].url #>
<#= offer.options[0].pricing.originalPrice #>
<#= offer.options[0].pricing.discountPercent #>
<#= offer.options[0].pricing.savings #>

An example of variable substitution within an Ad Unit might look like this:
<h2><#= offer.headline #></h2>

When an offer with the headline 50% off a Wonderful Experience is displayed within and Ad Unit, variable substitution will ensure that this snippet becomes:
<h2>50% off a Wonderful Experience</h2>