Last active
December 17, 2019 23:04
-
-
Save nimrodolev/144915a150d1fec09bd22df196b5ed0a to your computer and use it in GitHub Desktop.
Group of Jekyll tags for analytics setup
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
| {% if jekyll.environment == 'production' %} | |
| {%- if site.tracking.google_analytics -%} | |
| {%- include tracking/ga.html -%} | |
| {%- endif -%} | |
| {%- if site.tracking.google_tag_manager -%} | |
| {%- include tracking/gtm.html -%} | |
| {%- endif -%} | |
| {%- if site.tracking.facebook_pixel -%} | |
| {%- include tracking/fb.html -%} | |
| {%- endif -%} | |
| {%- if site.tracking.hotjar -%} | |
| {%- include tracking/hotjar.html -%} | |
| {%- endif -%} | |
| {% endif %} |
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
| {% assign code = site.tracking.facebook_pixel %} | |
| <!-- Facebook Pixel Code --> | |
| <script> | |
| !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'); | |
| fbq('init', '{{code}}'); | |
| fbq('track', 'PageView'); | |
| </script> | |
| <noscript> | |
| <img height="1" width="1" style="display:none" | |
| src="https://www.facebook.com/tr?id={{code}}&ev=PageView&noscript=1" /> | |
| </noscript> | |
| <!-- End Facebook Pixel Code --> |
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
| {% assign code = site.tracking.google_analytics %} | |
| <script async src="https://www.googletagmanager.com/gtag/js?id={{ code }}"></script> | |
| <script> | |
| window.dataLayer = window.dataLayer || []; | |
| function gtag(){dataLayer.push(arguments);} | |
| gtag('js', new Date()); | |
| gtag('config', '{{ code }}'); | |
| </script> |
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
| {% assign code = site.tracking.google_tag_manager %} | |
| <!-- Google Tag Manager --> | |
| <script> | |
| (function (w, d, s, l, i) { | |
| w[l] = w[l] || []; w[l].push({ | |
| 'gtm.start': | |
| new Date().getTime(), event: 'gtm.js' | |
| }); var f = d.getElementsByTagName(s)[0], | |
| j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = | |
| 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); | |
| })(window, document, 'script', 'dataLayer', '{{code}}'); | |
| </script> | |
| <noscript> | |
| <iframe src="https://www.googletagmanager.com/ns.html?id={{code}}" height="0" width="0" | |
| style="display:none;visibility:hidden"></iframe> | |
| </noscript> | |
| <!-- End Google Tag Manager (noscript) --> |
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
| {% assign code = site.tracking.hotjar %} | |
| <!-- Hotjar Tracking Code --> | |
| <script> | |
| (function (h, o, t, j, a, r) { | |
| h.hj = h.hj || function () { (h.hj.q = h.hj.q || []).push(arguments) }; | |
| h._hjSettings = { hjid: {{code}}, hjsv: 6 }; | |
| a = o.getElementsByTagName('head')[0]; | |
| r = o.createElement('script'); r.async = 1; | |
| r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv; | |
| a.appendChild(r); | |
| }) (window, document, 'https://static.hotjar.com/c/hotjar-', '.js?sv='); | |
| </script> | |
| <!-- End Hotjar Tracking Code --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment