Skip to content

Latest commit

 

History

History
61 lines (43 loc) · 2.08 KB

setPostback.markdown

File metadata and controls

61 lines (43 loc) · 2.08 KB

appnext.setPostback()

 
Type Function
Library appnext.*
Return value None
Keywords ads, advertising, appnext, setPostback
See also appnext.getPostback()

Overview

Set postback parameters that will be posted to your server after user installed an app (make sure to encode the values).

Syntax

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

String. The adKey returned for a previously created ad.

postback (required)

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

Examples

local appnext = require 'plugin.appnext'

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

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

-- Create your Ads
local interstitialPlacementID
local fullscreenPlacementID
local rewardedPlacementID

local platform = system.getInfo( "platformName" )
if ( platform == "iPhone OS" ) then
    interstitialPlacementID = "YOUR_IOS_INTERSTITIAL_PLACEMENT_ID"
    fullscreenPlacementID = "YOUR_IOS_FULLSCREEN_PLACEMENT_ID"
    rewardedPlacementID = "YOUR_IOS_REWARDED_PLACEMENT_ID"
elseif ( platform == "Android" ) then
    interstitialPlacementID = "YOUR_ANDROID_INTERSTITIAL_PLACEMENT_ID"
    fullscreenPlacementID = "YOUR_ANDROID_FULLSCREEN_PLACEMENT_ID"
    rewardedPlacementID = "YOUR_ANDROID_REWARDED_PLACEMENT_ID"
end

interstitialAdKey = appnext.createAd( "interstitial", interstitialPlacementID )
fullscreenAdKey = appnext.createAd( "fullscreen", fullscreenPlacementID )
rewardedAdKey = appnext.createAd( "rewarded", rewardedPlacementID )

appnext.setPostback( interstitialAdKey, "YOUR_POSTBACK_PARAMS_HERE" )