amp-htmlfacebook-pixelamp-analytics

viewContent event in AMP-pixel


in the normal facebook pixel analytics we ViewContent event. is there a way to replicate this functionality in amp.

     <amp-analytics type="facebookpixel" id="facebook-pixel">
        <script type="application/json">
        {
          "vars": {
            "pixelId": "xzy"
          },
          "triggers": {
            "trackPageview": {
              "on": "visible",
              "request": "pageview"
            }
          },
 "trackViewContent": {
              "on": "visible",
              "request": "eventViewContent",
              "vars": {
                "content_category": "myCustomEvent"
              }
            }
          }
        </script>
    </amp-analytics>

i have tried to use something like this but it seems to track page view but not the view content. Am i doing something wrong?


Solution

  • use amp-pixel. here is an example:

    amp-pixel src="https://www.facebook.com/tr?id=XXXXX&ev=PageView&noscript=1" layout="nodisplay" /amp-pixel