pollfish.setUserDetails()

类型 函数
返回值
修订 版本 2024.3703
关键词 广告, Pollfish, setUserDetails
另请参阅 pollfish.init()
pollfish.*

概述

设置用户详细信息。提供这些详细信息可能有助于提高针对用户的定向广告收入。

语法

pollfish.setUserDetails( options )
options (必填)

. 包含选项值的表 — 详情请参阅下一节。

选项参考

options 表包含用于指定用户详细信息的参数。

gender (可选)

字符串. 用户的性别。有效值包括 "male"(男), "female"(女)和 "other"(其他)。

facebookId (可选)

字符串. 用户的 Facebook ID。

twitterId (可选)

字符串. 用户的 Twitter ID。

location (可选)

. 用户的位置。location 表包含以下用于指定用户位置的参数

  • longitude — 可选 数字,表示经度。
  • latitude — 可选 数字,表示纬度。
  • horizontalAccuracy — 可选 数字,表示水平精度。

请注意,此表仅用于 iOS。对于 Android,您可以通过设置 "android.permission.ACCESS_FINE_LOCATION""android.permission.ACCESS_COARSE_LOCATION" 权限来自动获取位置信息。

requestUUID (可选)

字符串. 用于标识用户的唯一 ID。此 ID 也将通过服务器到服务器回调传递。

示例

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