Last active
February 26, 2018 23:59
-
-
Save postman31/9f4e3292cda5fa8d8af105bf62c1ca47 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function () { | |
var customTask = function(model) { | |
// if using other task then custom don't forget to save and call the original task | |
// save the original task | |
var originalOtherTask = model.get('checkProtocolTask') | |
var hitType = model.get('hitType'); | |
if (hitType == 'event') { | |
var eventCategory = model.get('eventCategory') | |
var eventAction = model.get('eventAction') | |
} | |
!function(f,b,e,v,n,t,s) | |
{if(f.fbq)return;n=f.fbq=function(){n.callMethod? | |
n.callMethod.apply(n,arguments):n.queue.push(arguments)}; | |
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; | |
n.queue=[];t=b.createElement(e);t.async=!0; | |
t.src=v;s=b.getElementsByTagName(e)[0]; | |
s.parentNode.insertBefore(t,s)}(window, document,'script', | |
'https://connect.facebook.net/en_US/fbevents.js'); | |
// Use your variable name that corresponds to facebook pixel Id | |
fbq('init', {{FB ID}}); | |
if (hitType == 'event') { | |
fbq('track', eventCategory + '_' + eventAction) | |
} else if (hitType == 'pageview') { | |
fbq('track', 'PageView'); | |
} | |
// call the original task | |
// originalOtherTask() | |
console.log(originalOtherTask); | |
} | |
return customTask | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment