inMobi.setUserDetails()

Type Function
Return value none
Revision Release 2024.3703
Keywords ads, advertising, InMobi, setUserDetails
See also inMobi.load()
inMobi.*

Overview

Allows you to set user-specific details for more fine-grained ad targeting.

Syntax

inMobi.setUserDetails( params )
params (required)

Table. Table containing InMobi user information — see the next section for details.

Parameter Reference

The params table can include the following user-specific details:

gender (optional)

String. The user’s gender. Valid options are "male" or "female".

userInterests (optional)

Table. Table of strings indicating the user’s interests. You can supply any or all of the following strings: "Business", "Tech", "Travel", "Shopping", "Entertainment", "Fashion", "Fitness", "Foodie", "Gamer", "Jobs", or "Sports". You must supply at least one value for this parameter to apply.

phoneAreaCode (optional)

String. The area code of the user’s phone number. For instance, the Republic of Ireland’s area code is "353".

postCode (optional)

String. The user’s post/postal code.

birthYear (optional)

Number. The user’s birth year, for instance 1986.

age (optional)

Number. The user’s age, for instance 30.

ageGroup (optional)

String. The user’s age group. Valid options are "under18", "18to24", "25to34", "35to44", "45to54", "55to65", or "above65".

education (optional)

String. The user’s education level. Valid options are "highSchoolOrLess", "collegeOrGraduate", or "graduateOrAbove".

Example

local inMobi = require( "plugin.inMobi" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.isError )
    end
end

-- Initialize the InMobi plugin
inMobi.init( adListener, { accountId="YOUR_ACCOUNT_ID", logLevel="debug" } )

-- Set the user details
inMobi.setUserDetails(
    {
        gender = "male",
        userInterests = { "Business", "Tech" },
        postCode = "K1A0B1",
        ageGroup = "25to34",
        education = "collegeOrGraduate"
    })