SDK For Facebook Playable Ads
I want to make HTML playable ad for Facebook platform and show user avatar in it. Is it possible? According to docs playable ad must not make any HTTP request. So I just can't make
Solution 1:
Facebook doesn't appear to offer any helpful information beyond "you need to call the function".
When a playable is served, this <script>
is injected into the <head>
:
const FbPlayableAd = {
onCTAClick() {
window.parent.postMessage("onCTAClick", "*");
},
};
To get around the missing FBPlayableAd
object, solution here was to insert the following <script>
after the <body>
tag:
<script type="text/javascript">
window.FBPlayableOnCTAClick = () => {
(typeof FbPlayableAd === 'undefined') ?
alert('FBPlayableAd.onCTAClick') : FbPlayableAd.onCTAClick();
}
</script>
And then the CTA button has this onClick:
onClick={() => window.FBPlayableOnCTAClick()}
This allowed us to clear issues with Babel complaining about the missing FbPlayableAd, works fine in test, and functions fine when uploaded to Facebook's Playable Preview tool.
Post a Comment for "SDK For Facebook Playable Ads"