Can I use p5.js to create playable ads for Google, Facebook and Unity ads?

I am currently working on building a 2D playable ad for a game and p5.js looks like the perfect library for my use case. In order to check whether it would work, I wrote a very simple inline code (using p5.min.js) to test on Facebook playable ad preview tool.

The file works perfectly on the browser (both the desktop and phone browser), however on the tool it fails on the case: Asset cannot contain any JavaScript redirects. It also displays some js code on the phone emulator screen of the tool.

What does this mean and how do I fix the issue? I’m sorry but I’m new to web development and javascript so any help would be greatly appreciated. This is my code in jsfiddle and this is the link to the Facebook playable ad preview tool.

Here’s the link to the uncompressed version of p5.js.

1 Like

Don’t think something like this is possible, if ad providers let any javascript run on their ads someone could easily write some malicious code that would then run across all of Facebook/Google. Not a good thing :frowning:

So I’m sure Facebook/Google would not let arbitrary JavaScript code run on any of their ads.

It seems you are facing an issue with the Facebook playable ad preview tool. It’s possible that the p5.js library contains some JavaScript code that is being identified as a redirect by Facebook’s tool, which is not allowed for playable ads.

You could try to edit the library to comment out the parts that cause the issue, but keep in mind that modifying the library might lead to unexpected behavior or compatibility issues. Since you are new to web development and JavaScript this may not be advisable.

2 Likes

They could also use q5#js, which is a minimalist alternative for p5*js. :bulb:

2 Likes

That does sound like a good use case for q5. I’m curious to know if that solves it :eyes: Let us know if you try it @salmaan25

1 Like