javascript - Facebook tracking AND Google tracking Script -
I have Google tracking conversions now I also need Facebook pixel tracking.
My Google head script looks like this:
& lt; Script & gt; (Function (I, S, O, G, R, A, M) {i ['GoogleAnalyticsObject'] = R; I [R] = I [R] || function () {(I [R]. C = I [r] .q || []). Push (argument)}, I [R] .L = 1 * New date (); a = s.create element (O), M = S. ElementElementBitagname (O) [0]; a.async = 1; a.src = g; m.parentNode.insertBefore (a, m)}) (window, document, 'script', '// www.google-analytics.com/analytics. Js', 'ga'); GA ('Create', 'XX-XXXXXXXX-X' 'Auto'); Ga ('Send', 'Pageview'); & Lt; / Script & gt; My javascript call for Google looks like this:
If (typeof GA! == 'undefined') {ga ('send', 'Event', 'blub', 'blub'); } Now I need to add Facebook tracking and I got this script from Facebook:
How can I integrate Facebook code without removing Google code? And if I use both then is there a problem?
BR
You can add it without any problems.
& lt; Script & gt; / * Facebook tracking * / (function () {var _fbq = window._fbq || (window._fbq = []); if (! _fbq.loaded) {var fbds = document.createElement ('script'); fbds Async = True; fbds.src = '//connect.facebook.net/en_US/fbds.js'; var s = document.getElementsByTagName ['script'] [0]; s.parentNode.insertBefore (FBDS, S); _fbq .loaded = true;}}) (); / * Google Analytics tracking * / (function (I, S, O, G, R, A, M) {i ['GoogleAnalyticsObject'] = R; I [R] = I [R] | function () {( I [R] .q = I [R] .q || []). Push (argument)}, I [R] .l = 1 * new date (); a = s.create element (o), m = S.getElementsByTagName (o) [0]; a.async = 1; a.src = g; m.parentNode.insertBefore (a, m)}) (window, document, 'script', 'www.google - analytics.com/analytics.js','ga '); GA ('Create', 'XX-XXXXXXXX-X' 'Auto'); Ga ('Send', 'Pageview'); & Lt; / Script & gt; For this event:
type if (ga! == 'undefined') {ga ('send', 'event', ' Blub ',' blub '); } Window._fbq = window._fbq || []; Window._fbq.push (['track', 'XXXXXXXXXXX', {'value': '0.00', 'currencyĆ¢ € ":' XXX '}]);
Comments
Post a Comment