Skip to content Skip to sidebar Skip to footer

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>:

constFbPlayableAd = {
    onCTAClick() {
      window.parent.postMessage("onCTAClick", "*");
    },
  };

To get around the missing FBPlayableAd object, solution here was to insert the following <script> after the <body> tag:

<scripttype="text/javascript">window.FBPlayableOnCTAClick = () => { 
  (typeofFbPlayableAd === '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"