pollfish.setUserDetails()

Type Function
Return value none
Revision 2017.3060
Keywords ads, advertising, Pollfish, setUserDetails
See also pollfish.init()
pollfish.*

Overview

Sets user details. Providing these details may help improve revenue with offers targeted for the user.

Syntax

pollfish.setUserDetails( options )
options (required)

Table. Table containing option values — see the next section for details.

Options Reference

The options table includes parameters for specifying user details.

age (optional)

String. User's age. Valid values are "12" up to "70", or "other".

gender (optional)

String. User's gender. Valid values include "male", "female", and "other".

ageGroup (optional)

String. User's age group. Valid values include:

  • "12_17"
  • "18_24"
  • "25_34"
  • "35_44"
  • "45_54"
  • "55_64"
  • "65_plus"
  • "other"
facebookId (optional)

String. User's Facebook ID.

twitterId (optional)

String. User's Twitter ID.

location (optional)

Table. User's location. The location table includes the following parameters for specifying user location:

  • longitude — Optional number representing longitude.
  • latitude — Optional number representing latitude.
  • horizontalAccuracy — Optional number representing horizontal accuracy.

Note that this table is only used for iOS. For Android you can get automatic location retrieval by setting the "android.permission.ACCESS_FINE_LOCATION" and "android.permission.ACCESS_COARSE_LOCATION" permissions.

customData (optional)

Table. Table with key-value pairs of data that you want to associate with the user.

requestUUID (optional)

String. A unique ID to identify a user. This ID is also passed through server-to-server callbacks.

Example

local pollfish = require( "plugin.pollfish" )

local function adListener( event )

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

-- Initialize the Pollfish plugin
pollfish.init( adListener, { apiKey="YOUR_API_KEY" } )

-- Set user details
pollfish.setUserDetails( { gender="female", ageGroup="25_34" } )