pollfish.init()

类型 函数
返回值
修订版 2024.3703 版本
关键字 广告、广告宣传、Pollfish、init
另请参见 pollfish.show()
pollfish.*

概述

pollfish.init() 初始化 Pollfish 插件。调用后,你必须等待 event.phase"init" 才能使用 pollfish.load() 加载调查。

注意

此调用需要 API 密钥,该密钥可通过 Pollfish 门户网站 获得。

语法

pollfish.init( adListener, params )
adListener (必需)

监听器. 将接收 adsRequest 事件的监听器函数。

params (必需)

. 包含 Pollfish 初始化值的表——有关详情,请参阅下一节。

参数参考

params 表包括 Pollfish 初始化的以下参数。

apiKey (必需)

字符串. 你从 Pollfish 门户网站 获取的 API 密钥。

developerMode (可选)

布尔值. 将此值设置为 true 以激活开发者模式。默认为 false

  • true 用于帮助开发者测试 Pollfish 调查在应用程序中的行为(不会展示已付费调查)。

  • false 激活发布模式。对已发布到应用商店的应用程序使用此模式(开始接收付费调查)。

requestUUID (可选)

字符串. 用于识别用户的唯一 ID。此 ID 也会通过服务器到服务器回调函数进行传递。

示例

local pollfish = require( "plugin.pollfish" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        pollfish.load()
    end

end

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