Getting Started Smaato Ad Tag
- A WebView is needed for in-app integrations
- Rich media ads will be rendered in iframe for mobile browsers
Introduction
The Ad Tag can be easily enriched with user targeting data, device ID, demographics or location data (see table below for more details). Furthermore, the Ad Tag gives you the option to choose ad dimension, an auto-reload timer, and ad display mode (inline or fullscreen). Lastly, Ad Tag can also be enriched using your ad server’s replacement macros to pass additional targeting data.
Ad Tag Code for In-App
Inline Ads
<div id="smaatoad" style="padding:0px"></div>
<script type="text/javascript" src="https://soma-assets.smaato.net/js/smaatoAdTag.js"></script>
<script>
function myJSCallBack(status) {
if (status == "SUCCESS") {
// TODO Handle ad available (Option)
} else if (status == "ERROR") {
// TODO Handle not ad available
}
};
SomaJS.loadAd({
adDivId: "smaatoad",
publisherId: REPLACE_WITH_PUBLISHER_ID,
adSpaceId: REPLACE_WITH_ADSPACE_ID,
autoReload: 240,
dimension: "xxlarge",
dimensionstrict: true,
keywords: "cars,shopping",
gender: "m",
age: 27
}, myJSCallBack);
</script>
Ad Tag Usage
Insert the code at the desired section of your application.
Replace REPLACE_WITH_ADSPACE_ID
with your Ad Space ID and replace REPLACE_WITH_PUBLISHER_ID
with your Publisher ID.
Ad Tag Advanced Usage
You can add additional targeting data by inserting additional parameter lines. Usually, you will insert your ad server’s replacement macros here instead of actual data. The format to be used is shown here:
PARAMETER: 'STRING'
(for string values) with quotation marks
PARAMETER: true
(for boolean values) WITHOUT quotations marks
PARAMETER: 12345
(for numeric values) WITHOUT quotation marks
Example:
city: 'Miami'
formatstrict: false
age: 25
You can also prevent your AdTag from auto-reloading by either setting the autoReload parameter to 0, or by adding the following code snippet just below your AdTag:
<button onclick = stopAutoReloadAd()>Stop Auto Reload Ad</button> <script>
function stopAutoReloadAd() {
SomaJS.stopAutoReloadAd();
}
</script>
Ad Tag Parameters
Parameter | Mandatory | Description | Possible Value | Example |
---|---|---|---|---|
<strong>adDivId</strong> |
Yes | The Div ID where the ad should be placed
Please Note: Ue unique Div IDs if there are multiple ad placements on one page
|
See example | ‘smaatoad’ |
<strong>dimension</strong> |
No | The desired dimension of ads to be returned. Standard Formats MMA (default): Any MMA size (the system will determine the right one for the requesting phone)
|
|
“mma” |
<strong>gender</strong> |
No | The user’s gender, if available | male,female,m,f | “m” |
<strong>gdpr</strong> |
No | Info: http://advertisingconsent.eu/
Parameter used to enable/disable gdpr |
1, 0 | 1 |
<strong>gdpr_consent</strong> |
No | Base64-encoded consent string
only when gdpr value is set to 1 |
See example | “BOMCfKjOMdcevABAB8AAAAAZ+A==” |
<strong>lgpd</strong> |
No | Info: https://en.wikipedia.org/wiki/General_Personal_Data_Protection_Law
Parameter used to enable/disable lgpd |
1, 0 | 1 |
<strong>lgpd_consent</strong> |
No | Base64-encoded consent string
only when lgpd value is set to 1 |
1, 0 | 1 |
<strong>age</strong> |
No | The user’s age.2-digit number. If only a range is available, use the mean average | See example | 25 |
<strong>keywords</strong> |
No | Tags (free text, case insensitive) describing the content | string: comma separated values | ‘motorsport,news,cars’ |
<strong>qs</strong> |
No | Query String: A search term entered by the user within the mobile site | string: comma separated values and + separate two part names e.g. San Franciso | ‘coffee,san+francisco’ |
<strong>sync</strong> |
No | Parameter used for requesting the ad synchronously. (Default: false) | true, false | true |
<strong>did</strong> |
Yes | Unified Device ID should be enriched with the device id (iOS and/or Android). The Ad Tag will automatically pick up the right parameter for you and let us know if it is iosadid or androidid.
iOS – Identifier for Advertising (IDFA) please refer to ASIdentifierManager Android – Google Android Advertising ID please refer to http://bit.ly/MBMTTJ Android – Android ID please refer to Settings.Secure.ANDROID_ID |
See example | ‘1D76F5D1-1983-47C8-B18D119D52E4597A’ |
<strong>diddnt</strong> |
Yes | Apple’s advertisingTrackingEnabled Property.
(false = user has decided against tracking – this is the opposite way around as on Android) Android limit ad tracking preference. (true = user has decided against tracking – this is the opposite from iOS) |
true, false | false |
<strong>coppa</strong> |
Yes | “0” will indicate if your content should not be treated as child-directed for purposes of COPPA
“1” will indicate that your content should be treated as child-directed for purposes of COPPA |
0, 1 | 0 |
<strong>cb</strong> |
No | Cachebuster. Insert your cachebuster macro here. This is optional: If no cachebuster is set, we’ll generate our own | string | ‘%%CACHEBUSTER%%’ (Dart) |
<strong>autoReload</strong> |
No | Automatically refresh ad. Value in seconds Minimum value: 10 | Any number, minimum: 10, maximum 240. | 45 |
<strong>latitude</strong> |
No
(but highly recommended) |
GPS coordinates of the user’s location (latitude) | Latitude as decimal degrees. | 37.530676 |
<strong>longitude</strong> |
No
(but highly recommended) |
GPS coordinates of the user’s location (longitude) | Longitude as decimal degrees. | -122.262447 |
<strong>country</strong> |
No | The country of the users location | See example | ‘United%20States’ |
<strong>countrycode</strong> |
No | The country code of the users location | See example | ‘US’ |
<strong>city</strong> |
No | The city name of the users location | See example | ‘New%20York’ |
<strong>zip</strong> |
No | The postal code of the users location | See example | ‘94402’ |
<strong>region</strong> |
No | The region of the users location | See example | ‘Texas’ |
<strong>useLocation</strong> |
No | Will enable user geolocation tracking
Important Note: This will trigger a popup to get users permission
|
true, false (default) | true |
<strong>ref</strong> |
Yes
(‘No’ if the device is requesting directly or if you are sending the correct referer header of the requesting webpage) |
Refers back to the origin of the user
(i.e. the URL of your mobile website) |
string | “http://my.website.com” |
<strong>iabcategory</strong> |
No
(but highly recommended) |
The Application or Mobile Website IAB category | string |
IAB-XXX or IAB-XXX-XXX |
<strong>adspacename</strong> |
No
(but highly recommended) |
The Adspace’s name. Please use the following format: AppOrSiteName_OSName_AdspaceDimension | string |
MyApp_iOS_320x50 |
Ads for Testing Purposes
Adspace ID | Type | Description |
---|---|---|
130626424 | Rich Media | Banner / Med-rect / Leaderboard / Skyscraper |
130635694 | Static Image | Banner / Med-rect / Leaderboard / Skyscraper |
130635706 | MRAID | Banner / Med-rect / Leaderboard / Skyscraper |
133150211 | Rich Media / Video | Interstitial (Video with an end-card + Rich Media Interstitial for 320×480, 480×320, 1024×768 & 768×1024) |
133150079 | Outstream | Outstream Video |
Last Modified: August 31, 2023 at 11:51 am