If you want to execute the Facebook Pixel without page reload, add the following script into a custom script section of the desired GDPR category, take care to replace your Facebook Pixel ID:
| Code: |
(function () {
if (window.__fbPixelInjected) return;
window.__fbPixelInjected = true;
if (!window.fbq) {
var f = function () {
f.callMethod ? f.callMethod.apply(f, arguments) : f.queue.push(arguments);
};
f.queue = [];
f.version = '2.0';
window.fbq = f;
window._fbq = f;
}
var t = document.createElement('script');
t.async = true;
t.src = 'https://connect.' + 'facebook.' + 'net/en_US/fbevents.js';
t.onload = function () {
fbq('init', 'XXXXXXXXXXXXXX');
fbq('track', 'PageView');
};
document.head.appendChild(t);
})();
|