Getting Started Smaato Ad Tag

Introduction

The Ad Tag is a lightweight JavaScript-based solution that makes it easy to integrate Smaato ads directly into your mobile website. The main usage of Ad Tag is for mobile websites, but it can also be used for in-app integrations.

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 and Mobile Web

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

Ad Tag Parameters

Parameter Mandatory Description Possible Value Example
adDivId Yes

The Div ID where the ad should be placed

See example ‘smaatoad’
dimension 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)

  • Medium Rectangle (300×250) 
  • Leaderboard(728×90)
  • Skyscraper(160×600)
  • Full screen(320×480)
  • Full screen(480×320)
  • Full screen(768×1024)
  • Full screen(1024×768)
  • “mma” 
  • “medrect” 
  • “leader” 
  • “sky”
  • “widesky”
  • “small”
  • “large”
  • “medium”
  • “xlarge”
  • “xxlarge”
  • “full_320x480” 
  • “full_480x320” 
  • “full_640x960” 
  • “full_960x640”
  • “full_1136x640”
  • “full_768x1024” 
  • “full_1024x768”
  • “full_800x1280”
“mma”
gender No The user’s gender, if available male,female,m,f “m”
gdpr No

Info: http://advertisingconsent.eu/

Parameter used to enable/disable gdpr

1, 0 1
gdpr_consent No

Base64-encoded consent string

only when gdpr value is set to true

See example “BOMCfKjOMdcevABAB8AAAAAZ+A==”
age No

The user’s age.2-digit number. If only a range is available, use the mean average

See example 25
keywords No

Tags (free text, case insensitive) describing the content

string: comma separated values ‘motorsport,news,cars’
qs 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’
sync No

Parameter used for requesting the ad synchronously. (Default: false)

true, false true
did 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’
diddnt 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
coppa 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
cb No

Cachebuster. Insert your cachebuster macro here. This is optional: If no cachebuster is set, we’ll generate our own

string ‘%%CACHEBUSTER%%’ (Dart)
autoReload No

Automatically refresh ad. Value in seconds Minimum value: 10

Any number, minimum: 10, maximum 240. 45
latitude

No

(but highly recommended)

GPS coordinates of the user’s location (latitude)

Latitude as decimal degrees. 37.530676
longitude

No

(but highly recommended)

GPS coordinates of the user’s location (longitude)

Longitude as decimal degrees. -122.262447
country

No

The country of the users location

See example ‘United%20States’
countrycode

No

The country code of the users location

See example ‘US’
city

No

The city name of the users location

See example

‘New%20York’
zip

No

The postal code of the users location

See example ‘94402’
region

No

The region of the users location

See example ‘Texas’
useLocation

No

Will enable user geolocation tracking

true, false (default) true
ref

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”
iabcategory

No

(but highly recommended)

The Application or Mobile Website IAB category

string
IAB-XXX or IAB-XXX-XXX
adspacename

No

(but highly recommended)

The Adspace’s name. Please use the following format: AppOrSiteName_OSName_AdspaceDimension

string
MyApp_iOS_320x50

Modified: September 30, 2019 at 1:38 pm