For the time being, it appears that no one at Facebook nor Google have added Facebook tracking pixel into amp-analytics yet.
Does anybody here knows how to do it ? sample code or github is preferred.
thank you very much
Hey just put my pixel on my google site and it worked, just use the embed feature on the side tool bar, add the pixel URL you got from Facebook and make the box really small, you can see the pixel is working at the top left of the picture I posted.
Set the type attribute for <amp-analytics> to "gtag" (to enable gtag. js support) and the data-credentials attribute to "include" (to enable cookies.) AMP does not allow any JavaScript beyond its own approved libraries, so configuration is instead performed with JSON.
Go to the Pixels tab. Click Manually add pixel code to website. Copy the code and paste it in Linkly, under Retargeting Pixels -> Head Tags. You'll want to add a custom tracking event to Facebook, so you'll know people came from this link.
This should work
<amp-pixel src="https://www.facebook.com/tr?id=YOUR_ID&ev=PageView&noscript=1"
layout="nodisplay"></amp-pixel>
You will need to change YOUR_ID
to the ID you can find in Facebook's tracking code.
I created this by adopting the noscript src from their sample script for use in amp-pixel. More advanced usages would be possible, but ideally Facebook would provide the respective documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With