1. Introduction

Installing the advanced FB Pixel (which includes CAPI and 1st party data integrations) has 3 components - First, installing the browser-based Facebook pixel and then, adding an entry to DNS settings to accommodate 1st party data flow and finally, adding a server-side cookie.

Once successfully installed, we should expect to see 93%+ match rate on the Facebook pixel and 1st party “cookies” that virtually never expire.

<aside> 💡

STOP! Is your product hosted on Shopify? Awesome! You can skip everything! Please tell your TNT Performance Manager and we’ll handle it from there.

</aside>

2. Installing the Browser-Based Pixel

2.1 “Base” Pixel

The following should be placed in the header on every page of your entire domain. If you insert code using GTM container, you may also use it to insert the code below:

<aside> 💡

NOTE: The below code is an example! The tracking URL used below, https://tnt.example.com should be replaced by your specific domain tracking URL which will be provided to you by your TNT Performance Manager.

</aside>

<script>
  window.edgetag=window.edgetag||function(){(edgetag.stubs=edgetag.stubs||[]).push(arguments)};
</script>
<script async type="text/javascript" src="https://tnt.example.com/load"></script> // insert tracking domain here, append '/load'

<script>
edgetag('init', {
  edgeURL: 'https://tnt.example.com', // insert tracking domain here
  disableConsentCheck: true
});
  edgetag('tag', 'PageView');
</script>

2.2 Installing the Purchase Event

At the point when a user makes a purchase, the following code should be fired:

<aside> 💡

NOTE: The contents array is not required, except if you plan on utilizing catalog ads on Meta.

</aside>

<script>
edgetag('data', {
  'email': '[email protected]', // required
  'phone': '+14154552670', // required
  'firstName': 'John', // required
  'lastName': 'Smith', // required
  'city': 'fremont', // required
  'state': 'ca', // required
  'country': 'us' // required
});

edgetag('tag', 'Purchase', {
  currency: 'USD', // required
  value: 31.00, // required
  orderId: '234234234234', // required
  eventId: '234234234234', // required
  contents: [
    {
      id: '123123123',
      quantity: 2,
      item_price: 10.50,
      title: 'Summer Fun',
      category: 'bracelets',
      image: 'https://mysite.com/product/fun-main.jpg',
      url: 'https://mysite.com/summer-fun'
    },
    {
      id: '4343434',
      quantity: 2,
      item_price: 5,
      title: 'Play shirt',
      category: 'shirts',
      image: 'https://mysite.com/product/play-main.jpg',
      url: 'https://mysite.com/play-shirt'
    }
  ]
});

edgetag('getData', ['isPurchased'], (data) => {
    const isReturning = data['isPurchased'] === '1';

    if(isReturning) {
      edgetag('tag', 'Purchase_RC', {
        currency: 'USD', // required
        value: 31.00, // required
        orderId: '234234234234', // required
        eventId: '234234234234', // required
        contents: [
       {
            id: '123123123',
            quantity: 2,
            item_price: 10.50,
            title: 'Summer Fun',
            category: 'bracelets',
            image: 'https://mysite.com/product/fun-main.jpg',
            url: 'https://mysite.com/summer-fun'
       },
      {
            id: '4343434',
            quantity: 2,
            item_price: 5,
            title: 'Play shirt',
            category: 'shirts',
            image: 'https://mysite.com/product/play-main.jpg',
            url: 'https://mysite.com/play-shirt'
          }
  ]
});
    } else {
      edgetag('tag', 'Purchase_NC', {
        currency: 'USD', // required
        value: 31.00, // required
        orderId: '234234234234', // required
        eventId: '234234234234', // required
        contents: [
       {
            id: '123123123',
            quantity: 2,
            item_price: 10.50,
            title: 'Summer Fun',
            category: 'bracelets',
            image: 'https://mysite.com/product/fun-main.jpg',
            url: 'https://mysite.com/summer-fun'
       },
      {
            id: '4343434',
            quantity: 2,
            item_price: 5,
            title: 'Play shirt',
            category: 'shirts',
            image: 'https://mysite.com/product/play-main.jpg',
            url: 'https://mysite.com/play-shirt'
          }
      ]
});
        edgetag('data', { isPurchased: '1' });
    }
});
</script>

<aside> 💡

NOTE: If you require additional events to be sent, for instance, Add to Cart/Initiate Checkout/Content View etc…you may send the same code as the purchase event above, simply changing the event name from Purchase to Add to Cart etc…

</aside>

3. Adding the Server-Side Cookie

Important considerations when installing your server-side cookie: