{"id":4307,"date":"2020-05-25T16:40:02","date_gmt":"2020-05-25T16:40:02","guid":{"rendered":"https:\/\/trackingchef.com\/?p=4307"},"modified":"2020-12-14T14:57:50","modified_gmt":"2020-12-14T11:57:50","slug":"why-all-tracking-pixels-are-essentially-the-same","status":"publish","type":"post","link":"https:\/\/trackingchef.com\/blog\/why-all-tracking-pixels-are-essentially-the-same\/","title":{"rendered":"Why all tracking pixels are essentially the same"},"content":{"rendered":"\n

Working for almost a decade with various web analytics platforms, I’ve come to realize that almost all platforms, analytics or advertising, behave in pretty much the same way.<\/p>\n\n\n\n

The reason for this standardization is simply because it just makes sense. The current iteration of these mechanisms is logical and simple to implement, so most platforms have aligned with it (except you LinkedIn, yes, I’m looking at you!).<\/p>\n\n\n\n

Understanding the common patterns between the platforms has helped me to easily add new tools to my belt and so can you.<\/p>\n\n\n\n

So why are these called pixels?<\/h2>\n\n\n\n

The name “tracking pixel” originates from the fact that most platforms transmit all their tracking data on top of an image (often a GIF file). The data is sent from the user’s browser when the website visited loads an image. This image is practically invisible, limited to a size 1×1 or even 0x0 pixels (hence the name pixel).<\/p>\n\n\n\n

\"\"
The response of the Google Analytics pixel.Yes, its that small dot just above the C.<\/figcaption><\/figure><\/div>\n\n\n\n

How data is transmitted on top of a pixel<\/h2>\n\n\n\n

The data that is transmitted is sent in the request to the server asking for the pixel. Some of the data is sent appended to the URL of the pixel requested. <\/p>\n\n\n\n

For example, Google Analytics tracking sends requests to the URL https:\/\/www.google-analytics.com\/r\/collect.<\/p>\n\n\n\n

On top of this URL, plenty of parameters pass the specific tracking data:<\/p>\n\n\n\n

\"\"
URL Parameters from the Google Analytics pixel<\/figcaption><\/figure><\/div>\n\n\n\n

At the bottom you can see the tid <\/em>parameter which stands for Tracking ID, and carries the value of the Google Analytics UA that this request should be associated with.<\/p>\n\n\n\n

Another way of transmitting data with the pixel is via the cookies on the site. Every request from the user’s browser carries all the data stored in the browser cookies for that domain. With privacy regulations becoming stricter, cookies have become a far less stable way of transmitting data.<\/p>\n\n\n\n

All pixel implementations are the same<\/h2>\n\n\n\n

Out of the box, almost all pixels use the same mechanism to fire:<\/p>\n\n\n\n

  1. JS Library load<\/li>
  2. Account identifier<\/li>
  3. Action<\/li><\/ol>\n\n\n\n

    JavaScript library load<\/h3>\n\n\n\n

    All modern pixels have a JavaScript (JS) library. This library contains all that’s required for the pixel to run smoothly and is loaded from an external file. Using an external file ensures that you’re always loading the most up to date version of the library. Self hosting a technically possible but never recommended.<\/p>\n\n\n\n

    Account identifier<\/h3>\n\n\n\n

    After the library has loaded, the pixel can be initialized in association with a specific account. This pairing is usually done once, and all consecutive pixel Actions will be associated with that account.<\/p>\n\n\n\n

    Action<\/h3>\n\n\n\n

    This is now the event we want to track. Most pixels support standard events, for example Page View, Add to Cart and Lead. Some pixels also allow custom events to be sent, to allow more granular custom tracking, for example scroll depth tracking.<\/p>\n\n\n\n

    Examples<\/h2>\n\n\n\n

    Facebook Pixel<\/h3>\n\n\n\n

    For the Facebook pixel, we can see a textbook example. The top part, mostly in gibberish, loads the JS library.<\/p>\n\n\n\n

    The fbq(‘init…) part associates the specific pixel ID, i.e. 706900066724012.<\/p>\n\n\n\n

    The fbq(‘track’…) part fires the specific Action, i.e. PageView.<\/p>\n\n\n\n

    The final part, encompassed in <noscript> tags, is for browsers that do not support JS, and loads the image pixel directly from the page’s HTML. You can see that the URL parameters appended to the image load the pixel ID and Action as in the full JS snippet.<\/p>\n\n\n\n

    <!-- Facebook Pixel Code -->\n<script>\n  !function(f,b,e,v,n,t,s)\n  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n  n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n  n.queue=[];t=b.createElement(e);t.async=!0;\n  t.src=v;s=b.getElementsByTagName(e)[0];\n  s.parentNode.insertBefore(t,s)}(window, document,'script',\n  'https:\/\/connect.facebook.net\/en_US\/fbevents.js');\n  fbq('init', '706900066724012');\n  fbq('track', 'PageView');\n<\/script>\n<noscript><img height=\"1\" width=\"1\" style=\"display:none\"\n  src=\"https:\/\/www.facebook.com\/tr?id=706900066724012&ev=PageView&noscript=1\"\n\/><\/noscript>\n<!-- End Facebook Pixel Code --><\/code><\/pre>\n\n\n\n

    Google Analytics<\/h3>\n\n\n\n

    For Google Analytics, you can see that the JS library loaded references my tracking ID, UA-89735590-3, though its contents don’t change between accounts.<\/p>\n\n\n\n

    The activation, gtag(‘config’…) performs two actions: Associates the specific tracking ID and fires the Pageview action.<\/p>\n\n\n\n

    <!-- Global site tag (gtag.js) - Google Analytics -->\n<script async src=\"https:\/\/www.googletagmanager.com\/gtag\/js?id=UA-89735590-3\"><\/script>\n<script>\n  window.dataLayer = window.dataLayer || [];\n  function gtag(){dataLayer.push(arguments);}\n  gtag('js', new Date());\n\n  gtag('config', 'UA-89735590-3');\n<\/script><\/code><\/pre>\n\n\n\n

    Quora Ads<\/h3>\n\n\n\n

    The Quora Ads pixel works just like the Facebook pixel.<\/p>\n\n\n\n

    The initial gibberish loads the JS library. The qp(‘init’…) associates the Quora pixel ID and then the Action triggers with qp(‘track’…). Unlike Google Analytics and Facebook, Quora chose ViewContent as the name for the Page View action, but it serves the same purpose.<\/p>\n\n\n\n

    The <noscript> tag in Quora is also the same as Facebook’s pixel, with a minor change with the pixel ID sent in a subfolder rather than URL parameter.<\/p>\n\n\n\n

    <!-- DO NOT MODIFY -->\n<!-- Quora Pixel Code (JS Helper) -->\n<script>\n!function(q,e,v,n,t,s){if(q.qp) return; n=q.qp=function(){n.qp?n.qp.apply(n,arguments):n.queue.push(arguments);}; n.queue=[];t=document.createElement(e);t.async=!0;t.src=v; s=document.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s);}(window, 'script', 'https:\/\/a.quora.com\/qevents.js');\nqp('init', 'e4a4302c721745a4a7ae79071b4782gb');\nqp('track', 'ViewContent');\n<\/script>\n<noscript><img height=\"1\" width=\"1\" style=\"display:none\" src=\"https:\/\/q.quora.com\/_\/ad\/e4a4302c721745a4a7ae79071b4782fc\/pixel?tag=ViewContent&noscript=1\"\/><\/noscript>\n<!-- End of Quora Pixel Code --><\/code><\/pre>\n\n\n\n

    But that’s just the standard pixel, what about other actions?<\/h2>\n\n\n\n

    Glad you asked.<\/p>\n\n\n\n

    So we understood that the “standard” tracking uses a similar mechanism, but so does the event\/conversion tracking.<\/p>\n\n\n\n

    Say you want to track a form submission with a Lead action.<\/p>\n\n\n\n

    For Facebook that would require sending:<\/p>\n\n\n\n

    fbq('track', 'Lead');\u200e<\/code><\/pre>\n\n\n\n

    If you’re using Pinterest Ads, it would similarly be:<\/p>\n\n\n\n

    pintrk('lead');<\/code><\/pre>\n\n\n\n

    Outbrain would look like this:<\/p>\n\n\n\n

     obApi('track', 'Lead');<\/code><\/pre>\n\n\n\n

    You get the point.<\/p>\n\n\n\n

    Pro tip:<\/strong>
    When adding the above via GTM, make sure you encompass the in <script> tags<\/p><\/blockquote>\n\n\n\n

    And here’s another tip:
    After the tracking pixel has been initialized on the page with the standard tag (Page View action or equivalent), to fire additional actions, all you have to do is trigger this one line. No need for you to load the rest of the code that’s part of the standard tag.<\/p>\n\n\n\n

    I see plenty of advertisers failing to implement this correctly. Loading the full tag won’t do any damage, it’s just plain inefficient. <\/p>\n\n\n\n

    So long story short, on any page you’ve already loaded the standard tag and you now want to trigger another action, simply call the action’s function. That’s it.<\/p>\n","protected":false},"excerpt":{"rendered":"

    Working for almost a decade with various web analytics platforms, I’ve come to realize that almost all platforms, analytics or advertising, behave in pretty much the same way. The reason for this standardization is simply because it just makes sense. The current iteration of these mechanisms is logical and simple to implement, so most platforms […]<\/p>\n","protected":false},"author":1,"featured_media":4308,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[],"_links":{"self":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/4307"}],"collection":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/comments?post=4307"}],"version-history":[{"count":8,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/4307\/revisions"}],"predecessor-version":[{"id":4806,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/4307\/revisions\/4806"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/media\/4308"}],"wp:attachment":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/media?parent=4307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/categories?post=4307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/tags?post=4307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}