pollfish.load()

Type Function
Return value none
Revision Release 2024.3703
Keywords ads, advertising, Pollfish, load
See also pollfish.show()
pollfish.*

Overview

pollfish.load() loads a Pollfish survey.

Once called, you can show the survey using pollfish.show(), assuming it's ready for display. You can confirm survey availability using pollfish.isLoaded().

Syntax

pollfish.load( params )
params (optional)

Table. Table containing Pollfish survey options — see the next section for details.

Parameter Reference

The params table includes the following parameters for the Pollfish initialization.

yAlign (optional)

String. Position of the survey button. Valid values include "top", "center", and "bottom". Default is "bottom".

xAlign (optional)

String. Alignment of the survey button. Valid values include "left" and "right". Default is "right".

padding (optional)

Number. Padding (in pixels) to adjust the vertical position of the survey button. Negative values shift the button up and positive values shift it down. Default is 0.

customMode (optional)

Boolean. Setting this to true activates "custom mode" as detailed below. Default is false.

  • Setting this to false (default) is the standard way of using Pollfish in your apps. This option enables controlling behavior (intrusiveness) of the Pollfish panel in an app from the Pollfish portal. In this mode, the survey panel/button will automatically be shown according to the settings in the Pollfish dashboard.

  • Setting this to true ignores the Pollfish panel behavior settings in the Pollfish portal. It always omits the Pollfish button and you must explicitly call pollfish.show() to display the loaded survey.

rewardMode (optional)

Boolean. Setting this to true activates "custom mode" as detailed below. Default is false.

Enables Pollfish in offerwall mode. If not specified Pollfish shows one survey at a time

offerwallMode (optional)

Boolean. Setting this to true activates "offerwall mode" which will show an offerwall of surveys. Default is false.

Example

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