pixel.js 651 B

1234567891011121314151617181920212223
  1. const PIXEL_ID = document.currentScript.getAttribute("data-pixel-id");
  2. function initializeFacebookPixel(f, b, e, v, n, t, s) {
  3. if (f.fbq) return;
  4. n = f.fbq = function () {
  5. // eslint-disable-next-line
  6. n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
  7. };
  8. if (!f._fbq) f._fbq = n;
  9. n.push = n;
  10. n.loaded = !0;
  11. n.version = "2.0";
  12. n.queue = [];
  13. t = b.createElement(e);
  14. t.async = !0;
  15. t.src = v;
  16. s = b.getElementsByTagName(e)[0];
  17. s.parentNode.insertBefore(t, s);
  18. }
  19. initializeFacebookPixel(window, document, "script", "https://connect.facebook.net/en_US/fbevents.js");
  20. window.fbq("init", PIXEL_ID);