The power of the HTML5 inside Construct 3. Create HTMLElements, handle events and manage CSS style.
I create a game for facebook instant game.
I tried to add facebook pixel in the game. I followed facebook tutorial and tried to achieve something like this using HTMLElement:
<noscript>
<img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id={your-pixel-id-goes-here}&ev=PageView&noscript=1"/>
</noscript>
So I do it like this:
i.imgur.com/9gw43SA.png
I put them in the first layout of the game.
it work like charm, at least in pc and android.
Ok, thanks.
Try to guess:
caniuse.com/mdn-html_elements_noscript
You can use <noscript> only with iOS 14+
I know that might be the issue, that's why I only use default value and didn't change anything (which is only div tag, and no other properties), and still the game cannot load.
It load perfectly when I remove HTMLElement completely from my project.
Thank for your help,
Actually I only want to inform you about the error in iOS.
But as I don't have any data regarding the issue, it will be an impossible task.
Without an error message log it is complicated to figure out where the problem is.
If you just need to add a pixel you can try doing it directly on C3 without the need for specific plugins.
You can add a script like this when starting the first layout:
+ System: On start of layout
-> Run JavaScript: const noScript = document.createElement("noscript");
const img =document.createElement("img");
const yourPixelId = "abc"
img.height = "1";
img.width = "1"
img.style.display = "none";
img.src = `https://www.facebook.com/tr?id=${yourPixelId}&ev=PageView&noscript=1`;
noScript.appendChild(img);
document.body.appendChild(noScript);
This is a simple c3p file: drive.google.com/file/d/1fdQ1oGPKmY2IXOIJbMAanw5n0a6xvJom/view