appnext.setPostback()

Type Function
Return value none
Revision 2017.3060
Keywords ads, advertising, Appnext, setPostback
See also appnext.getPostback()
appnext.*

Overview

Sets postback parameters that will be posted to your server after user installs an app. Make sure to encode the values.

Syntax

appnext.setPostback( adKey, postback )
adKey (required)

String. The ad key returned for a previously created ad.

postback (required)

String. The postback parameters to be set for the ad.

Example

local appnext = require( "plugin.appnext" )

local function adListener( event )
    print( "Received " .. event.event .. " for " .. event.adKey .. " with message: " .. event.message )
end

-- Initialize the Appnext plugin
appnext.init( adListener )

-- Create your ads
local interstitialPlacementID

local platform = system.getInfo( "platformName" )
if ( platform == "iPhone OS" ) then
    interstitialPlacementID = "YOUR_IOS_INTERSTITIAL_PLACEMENT_ID"
elseif ( platform == "Android" ) then
    interstitialPlacementID = "YOUR_ANDROID_INTERSTITIAL_PLACEMENT_ID"
end

local interstitialAdKey = appnext.createAd( "interstitial", interstitialPlacementID )

appnext.setPostback( interstitialAdKey, "YOUR_POSTBACK_PARAMS_HERE" )