# Analytics.json: facebookPixel definition

This article shows step-by-step how to configure Facebook Pixel in an analytics.json file.

The AMP's configuration of Facebook Pixel can be found here (opens new window)

We can see that the only required variable is pixelId (opens new window)

This means that the vars definition only contains pixelId:

{
  "vars": {
    "pixelId": "THE_PIXEL_ID"
  }
}

On the other hand, we can see that in Marfeel AMP legacy implementation (opens new window) we send multiple extra query parameters:

  • dl: CANONICAL_URL
  • rl: DOCUMENT_REFERRER
  • if: false
  • ts: TIMESTAMP
  • es: APP

AMP Variable replacement

Some of these variables are AMP's variables and they are replaced during the AMP run-time. Refer to AMP specification to know more (opens new window).

We can add those in extraUrlParams:

 {
    "extraUrlParams": {
      "dl": "${CANONICAL_URL}",
      "rl": "DOCUMENT_REFERRER",
      "if": false,
      "ts": "TIMESTAMP",
      "es": "APP"
    }
 }

Finally, if we check the Marfeel legacy js implementation (opens new window) we don't see any other variable. This means we don't have to create the touchVars field at all.

The final, default configuration for FacebookPixel is:

 {
    "vars": {
     "pixelId": "THE_PIXEL_ID"
    },
    "extraUrlParams": {
      "dl": "${CANONICAL_URL}",
      "rl": "DOCUMENT_REFERRER",
      "if": false,
      "ts": "TIMESTAMP",
      "es": "APP"
    }
 }