Salesforce

« Go Back
Information
Macros
Macros
Details

Overview

Macros are variables that are replaced by actual values when an ad is delivered. For example, the [sas_insertionId] macro is replaced by the actual insertion ID containing the delivered creative.

Fields supporting macros 

Macros can be used in the following fields:

Templating processor

The templating processor uses the DotLiquid templating engine.
Note the following:
  • The {{ model.Doc }} macro lets you access all available fields.
  • Instructions referencing data must use the model prefix: {{ model.CamelCaseProperty }}.
  • In the javascript creative template, add /* {{model.Doc}} */ at the top of the template to see the documentation when running tests.

Macro indexing

Creative macros can be indexed using the format [sas_creativeId_#1] or {{ model.Creatives.1.Id }}). When indexed, the macros will be replaced when you put the insertion online. Non-indexed creative macros, such as [sas_creativeId], are replaced upon delivery of the insertion.
Creative rotation modes are supported in creative templates with non-indexed creative macros only. 

Macro filters

Macro filters let you post-process the result of a macro in a particular way, for example to achieve escaping.
The syntax to apply a filter to a macro is [macroName|filterName], where macroName is the name of the macro, and filterName is the name of the filter to apply.
You can apply more than one filter to the same macro, for example: [macro|filter1|filter2]. In this case, filters are always evaluated from left to right.

The available filters include the following:
Stacking too many filters on the same macro may have effects on the performance of template processing, when ads are delivered. Ideally, do not stack more than two filters for the same macro.
 

Macro filter example

!function(w, d) {
var ad = {
  imageUrl: "[sas_creativeUrl|jsonEncoded]",
  altText: "[sas_imageAltText|jsonEncoded]",
  clickUrl: "[sas_creativeClickCountPixelUrl|jsonEncoded]"
}
var tag = d.getElementById("[sas_tagId|jsonEncoded]")
var ce = function (n) { return d.createElement(n) }
var ac = function (p, c) { p.appendChild(c) }
var div = ce("div")
var a = ce("a")
a.href = ad.clickUrl
var img = ce("img")
img.alt = ad.altText
img.src = ad.imageUrl
var p = ce("p")
ac(p, d.createTextNode(ad.altText))
ac(a, img)
ac(a, p)
ac(div, a)
ac(tag, div)
}(window, document)

Macro reference

Macro________________________________________Description
[countgo]The click counting redirect URL of third party creative scripts. It counts the click and redirects to the final destination URL. To be replaced by [sas_creativeClickUrl] in a future release.
[countgoEncoded]The URL encoded version of [countgo].
[sas_adbreak]The ad break provided in the ad call.
[sas_addtl_consent]The Google Additional Consent string, passed in the ad call with the addtl_consent= parameter. Example: 1~1.35.41.101.
[sas_advertiserId]The ID of the advertiser.
[sas_androidIdMD5]The MD5 hash of the unique ID (Android only).
[sas_androidIdSHA1]The SHA1 hash of the unique ID (for Android only).
[sas_appname]The name of the app.
[sas_bundleid]The bundle ID of the app.
[sas_campaignId]The ID of the campaign.
[sas_cookieId]The user ID from the user’s pid cookie.
[sas_cpm]The CPM of the insertion in the network’s currency or in the overridden currency if a different currency is specified in the ad call.
[sas_creativeBaseUrl]The base domain of the creative's URL (Equativ CDN).
[sas_creativeClickCountPixelUrl]The URL of the counting pixel for clicks of the selected creative.
[sas_creativeClickTarget]The click target or _blank, if empty.
[sas_creativeClickUrl]The click counting redirect URL of third party creative scripts. It counts the click and redirects to the final destination URL. This macros will replace [countgo] in a future release.
[sas_creativeCountPixelUrl]The URL of the counting pixel for the selected creative. It remains empty if mobile ad prefetching is disabled.
[sas_creativeFileName]The file name of the creative.
[sas_creativeHeight]The height of the creative.
[sas_creativeHtmlDocument]A macro used to inject DSP markup inside a valid HTML document. The creative markup must be embedded into a valid HTML document with a centered body. The markup provided by the DSP is rendered verbatim if it ends with the string /html>
[sas_creativeHtmlDocumentJSON]The JSON escaped version of [sas_creativeHtmlDocument].
[sas_creativeId]The creative ID.
[sas_creativeMimeType]The creative MIME-type.
[sas_creativeName]The creative's name, as specified in the Name field of the creative.
[sas_creativeOriginalClickUrl]The original click URL of the creative, as specified in EMP. This macro is related to [sas_creativeClickUrl], which is replaced by a Equativ URL which redirects to this original click URL.
[sas_creativeScriptCode]The creative’s code or ‘’, if empty.
[sas_creativeScriptJSON]The creative code, escaped for JSON.
[sas_creativeType]The base of the CreativeFormatImage field:
  • 0: type script
  • 1: image
  • 2: mp4
  • 3: deprecated
  • 4: HTML5
[sas_creativeUrl]The URL of the creative (Equativ CDN URL).
[sas_CreativeVideoCompleteCountPixelURL]The URL of the counting pixel for the Complete metric of the selected video creative.
[sas_CreativeVideoFirstQuartileCountPixelURL]The URL of the counting pixel for the First quartile metric of the selected video creative.
[sas_CreativeVideoMidPointCountPixelURL]The URL of the counting pixel for the Midpoint metric of the selected video creative.
[sas_CreativeVideoStartCountPixelURL]The URL of the counting pixel for the Start metric of the selected video creative.
[sas_CreativeVideoThirdQuartileCountPixelURL]The URL of the counting pixel for the Third quartile metric of the selected video creative.
[sas_CreativeViewableImpressionCountPixelUrl]The URL of the counting pixel for the Viewable impression metric of the selected video creative.
[sas_creativeWidth]The width of the creative.
[sas_customisedScriptCode]The stringified code from the "Custom script" field of the insertion.
[sas_customisedScriptJSON]The version of the script code that can be used in JSON.
[sas_deviceId]The Android Advertising Identifier (Android mobile devices and Android TV) or the Apple IDFA (iOS devices and Apple TV).
[sas_deviceIdMD5]The MD5 hash of the unique ID.
[sas_deviceIdSHA1]The SHA1 hash of the unique ID.
[sas_externalId]The external ID of the insertion.
[sas_formatId]The ID of the format.
[sas_gdpr_applies]A boolean indicating if the GDPR applies.
  • true, if gdpr=1 is passed in the ad call
  • false, if gdpr=0 is passed in the ad call
  • unknown, if the gdpr= parameter is missing in the ad call
[sas_gdpr_consent]The value of the gdpr_consent= parameter passed in the ad call.
[sas_insertionCountPixelUrl]The URL of the counting pixel for the selected insertion.
[sas_insertionId]The ID of the insertion.
[sas_InsertionVideoCompleteCountPixelURL]The URL of the counting pixel for the Complete metric of the selected video insertion.
[sas_InsertionVideoFirstQuartileCountPixelURL]The URL of the counting pixel for the First quartile metric of the selected video insertion.
[sas_InsertionVideoMidPointCountPixelURL]The URL of the counting pixel for the Midpoint metric of the selected video insertion.
[sas_InsertionVideoStartCountPixelURL]The URL of the counting pixel for the Start metric of the selected video insertion.
[sas_InsertionVideoThirdQuartileCountPixelURL]The URL of the counting pixel for the Third quartile metric of the selected video insertion.
[sas_InsertionViewableImpressionCountPixelUrl]The URL of the counting pixel for the Viewable impression metric of the selected video insertion.
[sas_instanceCount]The number of instances per format: either the instances specified on format level or the value passed with the ps= parameter in the ad call. This macro is used for VAST ad calls only.
[sas_instanceIndex]The current instance index: the number of the tag instance, used when calling multiple instances of a format in a OneCall.
[sas_ip]The IP address of the ad call.
[sas_isAsyncCall]A boolean indicating if an ad call is async or not.
[sas_isSecureConnection]A boolean indicating if the ad call is secure or not. True if the call is https; false otherwise.
[sas_keywordTargeting]The keyword targeting criteria.
[sas_kw|keyword]The value of the specified keyword, extracted from the keyword targeting. The available keywords are the ones returned by the [sas_keywordTargeting] macro.
For example, if [sas_keywordTargeting] returns $dt=0t;sex=male;age=40;car=mercedes;
then:
  • [sas_kw|age] returns 40
  • [sas_kw|sex] returns male
  • [sas_kw|$dt] returns 0t
[sas_latitude]The latitude, if available (mobile SDK ad calls only). The format is culture invariant, for example: 48.856578.
[sas_longitude]The longitude, if available (mobile SDK ad calls only). The format is culture invariant, for example: 2.351828.
[sas_mobileModel]The model of the phone.
[sas_mobileVendor]The vendor (manufacturer) of the phone, for example Samsung.
[sas_networkId]The ID of the customer's network.
[sas_noadImpressionPixelUrl]The noad pixel URL.
[sas_noCookie]A boolean indicating the the user's cookie/tracking choices.
True, if the user is opted out for web cookie or tracking in apps; false otherwise.
[sas_os]The operating system: empty, ios or android.
[sas_pageDomain]The encoded page domain of the page where the Equativ ad tag is integrated. The page domain is extracted from the value of the pgDomain parameter in the ad call.
[sas_pageDomainRaw]The unencoded version of [sas_pageDomain].
[sas_pageId]The ID of the page passed in the ad call or the ID of the page found with the page name in the ad call.
[sas_pageName]The name of the page in the ad call.
[sas_pixelDomain]The base URL of pixels. The value varies depending on the data center which issued the ad response.
[sas_platform]The ID of the platform provided in the ad call, extracted from the user-agent.
  • 1: Desktop
  • 2: Smartphone
  • 4: Tablet
  • 8: Connected TV
  • 16: Connected Device
  • 32: Set Top Box
  • 64: Game Console
[sas_protocol]The protocol of the ad call: https if the call is secure; http otherwise.
[sas_publisherCurrencyCode]The currency defined in the customer network, following the ISO 4217 standard for currency codes, for example EUR or USD.
[sas_referrer]The encoded referrer.
[sas_referrerraw]The unencoded version of [sas_referrer].
[sas_rtb_advertiserId]The advertiser ID.
[sas_rtb_advertiserIdName]The advertiser ID and name, separated by a comma.
[sas_rtb_auctionId]The auction ID.
[sas_rtb_auctionType]The auction type: OpenAuction, PrivateAuction, DirectDeal, GuaranteedDeal or AuctionPackage.
[sas_rtb_bidLogTimeTicks]The timestamp of the bid request log.
[sas_rtb_buyerId]The buyer ID.
[sas_rtb_buyerIdName]The buyer ID and name, separated by a comma.
[sas_rtb_campaignId]The campaign ID from the cid field in the Bid object.
[sas_rtb_clearedPricePublisherCurrency]The price paid to the publisher by the DSPs.
[sas_rtb_creativeId]The creative ID from the crid field in the Bid object.
[sas_rtb_dealExternalId]The external deal ID.
[sas_rtb_dealId]The deal ID.
[sas_rtb_dealIdName]The deal ID and deal name, separated by a comma.
[sas_rtb_dspId]The DSP ID.
[sas_rtb_dspIdName]The DSP ID and name, separated by a comma.
[sas_rtb_environmentType]The environment type: Web (desktop), Mobile Web or App.
[sas_rtb_impressionHash]The hash of the impression key to verify the integrity and source.
[sas_rtb_publisherId]The publisher ID.
[sas_sib_cpm_currency]The network’s currency or the overridden currency if a different currency is specified in the ad call; empty string otherwise.
This macro applies to Equativ in-app bidding calls only.
[sas_sib_cpm]The net paid price in the network’s currency or in the overridden currency if a different currency is specified in the ad call; 0 otherwise.
This macro applies to Equativ in-app bidding calls only.
[sas_sib]A boolean indicating if the call is an Equativ in-app bidding call. 1 if the call is an Equativ in-app bidding call; 0 otherwise.
[sas_siteId]The site ID passed in the ad call.
[sas_smartBaseUrl]The base domain of the Equativ ad call—for example, www5.smartadserver.com—or the CNAME domain if registered.
[sas_tagId]The DOM tag ID where the ad is rendered.
The standard name of the tag ID is: sas_<format id>.
[sas_target]Thew targeting string of the current ad call; URL encoded, by default.
[sas_targetraw]The unencoded version of [sas_target].
[sas_templateId]The ID of the creative template.
[sas_trackClickUrls]The array of tracking click URLs (direct campaigns and RTB).
[sas_transactionid]The unique click ID, used to correlate conversions tracked by Equativ with those tracked by third party tracking platforms. The [sas_transactionid] macro is used as the value of the click ID parameter, for example clickid=[sas_transactionid] or cid=[sas_transactionid].
This macro can only be used in the Click URL of the creative. For more information, see Click ID based conversion tracking.
[sas_uid]The unique user ID sent with the uid parameter, used for frequency capping and other user related features.
[sas_userAgent]The user-agent provided in the ad call.
[sas_userAgent|urlEncoded]The URL encoded version of [sas_userAgent].
[sas_videoBitRate]The bitrate of a video ad.
[sas_videoClientTechnology]The video client technology ID.
  • 1: deprecated
  • 2: Javascript
  • 3: iOS App
  • 4: Android App
  • 5: tvOS App
  • 6: AndroidTV App
  • 7: Amazon Fire TV App
[sas_videoContentPlayer]The video player ID.
  • 1: JW Player 5
  • 2: JW Player 6
  • 3: JW Player 7
  • 4: Flowplayer
  • 5: Ooyala
  • 6: Kaltura
  • 7: Brightcove
  • 8: OSMF
  • 9: JW Player SDK
  • 10: Ooyala SDK
  • 11: Brightcove SDK
  • 12: AVPlayer
  • 13: VideoView
  • 14: ExoPlayer
[sas_videoDuration]The duration of the video ad.
[sas_videoIntegrationType]The video integration type
  • 1: Instream Plugins
  • 2: Instream Embedded Ad Manager
  • 3: Outstream synchronous formats (obsolete)
  • 4: Outstream asynchronous formats
  • 5: Server side ad insertion (SSAI)
[sas_videoplayerheight]The value of the vph parameter passed in the ad call.
[sas_videoplayerwidth]The value of the vpw parameter passed in the ad call.
[sas_videoRevisionNumber]The revision number of the player or SDK.
[timestamp]The timestamp of an ad call.

Powered by