Type Function Return value none Revision 2017.3060 Keywords ads, advertising, Pollfish, init See also pollfish.show() pollfish.*
pollfish.init() initializes the Pollfish plugin. Once called, you must wait for an event.phase of "init" before loading a survey with pollfish.load().
This call requires an API key which can be obtained from the Pollfish portal.
pollfish.init( adListener, params )
Listener. Listener function that will receive adsRequest events.
Table. Table containing Pollfish initialization values — see the next section for details.
The params table includes the following parameters for the Pollfish initialization.
String. Your API key from the Pollfish portal.
Boolean. Setting this to true activates developer mode. Default is false.
true is used to help the developer test how Pollfish surveys will behave in the app (no paid surveys are presented).
false activates release mode. Use this mode for apps released to the app store (start receiving paid surveys).
String. A unique ID to identify a user. This ID is also passed through
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" } )