Path expressions and macros

There are some resource properties in the Mopedo DSP, where it’s possible to make reference to other data sources by using path expression strings. The best example is bid rule conditions, where we use path expressions as the values of the Key property.

Here is the complete list of places where path expression strings can be used:

Path expressions

Path expressions are used to reference a property of some data source, and consist of the name of a data source, followed by names of properties divided by dots.

Available data sources

User

Used to denote the User contained in a bid request

Device

Used to denote the Device contained in a bid request

Site

Used to denote the Site contained in a bid request

App

Used to denote the App contained in a bid request.

Used to denote the Banner contained in a bid request

Now

Used to denote the static Now resource

Example path expressions

Path expressions are case sensitive. For more information about the properties of the above data sources, see their respective documentation.

1
2
3
4
5
6
7
8
9
10
11
User.UserId
Device.Geo.Longitude
Site.Publisher.Domain
Banner.Width
Banner.AboveTheFold
App.Bundle
User.AdWinCount(ad001) // where ad001 is an ad id
Device.Extension.deviceGroup
Now.Hour
Device.CreatedAt
User.Extension.usergroup

For more examples, see the advertising example section of the documentation.

Macros

Sometimes it’s useful to insert values from path expressions straight into the AdMarkup and LandingPage strings of Ad entities. This allows us to, for example, include banner ad slot dimensions in the call to an ad server, or insert user information in the URL that is called when a banner ad is clicked. To allow this, there is support for macros in the AdMarkup and LandingPage strings. All the data sources detailed above can be used for this. Macros have the following syntax:

1
$(<path expression>)

Where <path expression> is a path expression.

Examples

Using macros, we can insert the banner dimensions into an iframe in AdMarkup.

1
"AdMarkup": "<iframe width='$(Banner.Width)' height='$(Banner.Height)' frameBorder='0' src='http://my-dsp.com/getmarkup?ad=0123&uid=$(User.Extension.UID)'> </iframe>"

In the example, we also include a UID from the UserExtension object belonging to the User of the bid request in the call to the ad server.a