Type Function

Return value none

See also admob.*


Loads a specified ad unit. It also allows you to specify additional targeting parameters. To understand all of them please read targeting guides for iOS and Android.



params required

Table. Contains parameters for the call — see the next section for details.

Parameter Reference

The params table includes parameters for the call.

type optional

String. Type of the ad unit: 'banner', 'interstitial' (default) or 'rewarded'.

id required

String. Ad unit id, e.g. 'ca-app-pub-3940256099942544/1033173712'.

immersive optional

Boolean. If true, the video ad will hide onscreen navigation bar on Android.

user_id optional

String. Sets the user ID to be used in server-to-server reward callbacks.

keywords optional

Array. A set of string keywords to be used when an ad is being chosed. E.g. {'action', 'game'}. It may increase your revenue by displaying relevant ads.

gender optional

String. User gender: 'male' or 'female'.

is_designed_for_families optional

Boolean. Set it to true if your app is accepted as “Designed For Families”. Android only.

tag_for_child_directed_treatment optional

Boolean. For purposes of the Children’s Online Privacy Protection Act (COPPA), there is a setting called “tag for child-directed treatment”. By setting this to true, you certify that this notification is accurate and you are authorized to act on behalf of the owner of the app. You understand that abuse of this setting may result in termination of your Google account.

Boolean. See Users under the age of consent, default is false. iOS only for now.

non_personalized optional

Boolean. Set it to true if you would like to request non-personalized ads. Under the Google EU User Consent Policy, you must make certain disclosures to your users in the European Economic Area (EEA) and obtain their consent to show personalized ads. This policy reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR).

restricted_data_processing optional

Boolean. Set it to true if you would like to restrict data processing for compliance with the California Consumer Privacy Act (CCPA).

max_ad_content_rating optional

String. AdMob returns ads with a content rating at or below the specified level. Possible values are: 'G', 'PG', 'T', 'MA'.

birthday optional

Table. A table with three numeric components of a date: year, month and day. All fields are required. E.g. {year = 1970, month = 1, day = 1}.

location optional

Table. A table with three numeric components of a location: latitude, longitude and accuracy. All fields are required. E.g. {latitude = 59.3385206, longitude = 18.0303522, accuracy = 20}.

content_url optional

String. When requesting an ad, apps may pass the URL of the content they are serving. E.g. a blog post URL or a news URL that is being shown in your app.

size optional

String. Banner size to load: 'banner' (default), 'large', 'medium', 'full', 'leaderboard', 'smart', 'smart_portrait' (iOS only), 'smart_landscape' (iOS only).

See “Banner sizes” section on Admob Android Banner and Admob iOS Banner pages for more details.

If a selected banner size can’t fit on screen, it won’t be displayed. A good option is to use the 'smart' banner size, in this case the actual size is adapted to the screen width.

position optional

String. Banner position on screen: 'top' or 'bottom' (default).


-- Load rewarded video ad.
	type = 'rewarded',
	id = 'ca-app-pub-3940256099942544/5224354917',
	immersive = true,
	keywords = {'action', 'game'}

-- Load banner ad.
	type = 'banner',
	id = 'ca-app-pub-3940256099942544/6300978111',
	keywords = {'action', 'game'},
	size = 'smart',
	position = 'top'