TheBestBigAl
TheBestBigAl

Reputation: 1230

Manually trigger click on Facebook Native Ad

I am using Corona Enterprise, and my entire UI is defined in Corona's Lua code. I have setup Facebook Native Ads, successfully requested a test ad, and then used:

nativeAd.getAdCoverImage().getUrl()
nativeAd.getAdCoverImage().getWidth()
nativeAd.getAdCoverImage().getHeight()

to successfully download the ad image and display it at the correct ratio in my Lua code using:

local function fbImageListener(event)
    if event and event.response and event.response.filename then
        print("received cover image")
        local testImage = display.newImageRect(mainGroup, event.response.filename, system.TemporaryDirectory, e.coverwidth, e.coverheight)
        testImage.x, testImage.y = display.contentWidth * 0.5, display.contentHeight * 0.5
    end
end
network.download( e.coverurl, "GET", fbImageListener, "fbAd.png", system.TemporaryDirectory)

The problem I now have is that if I add a touch listener in my Lua code to the new display object, I don't know how to trigger the "AdClicked" function in the FB SDK.

I need to put the native ad into my corona display group because it will appear as a billboard in the game world, and needs to be able to move and scale with the rest of that group.

Is there a way to trigger the click call manually?

Upvotes: 0

Views: 824

Answers (1)

Jenny Abrahamson
Jenny Abrahamson

Reputation: 171

It is possible to manually trigger clicks and impressions, but you'll need to be whitelisted by Facebook for that functionality. You can create a support case to request this from your Audience Network dashboard

See instructions here for getting help: https://developers.facebook.com/docs/audience-network/faq#g1

Upvotes: 2

Related Questions