pollfish.setUserDetails()

Type Function
Return value none
Revision Release 2024.3703
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.

gender (optional)

String. User's gender. Valid values include "male", "female", and "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.

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" } )