viewContent event in AMP-pixel

645 Views Asked by At

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?

4

There are 4 best solutions below

1
On BEST ANSWER

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
0
On

Not supported. AMP-pixel clearly states that it's used as a typical tracking pixel to count pageviews. No mention of view content.

0
On

Just replace "PageView" in the link to "ViewContent"

<amp-pixel src="https://www.facebook.com/tr?id=&ev=ViewContent&noscript=1"
    layout="nodisplay"></amp-pixel>
0
On

Add "selector": "html"

"trackViewContent": {
  "on": "visible",
  "selector": "html",
  "request": "eventViewContent",
...
...