Last active
October 23, 2017 16:25
-
-
Save zanona/7da267003b6778ac1e9b61eca7f54643 to your computer and use it in GitHub Desktop.
Sanitised web service snippets
This file contains 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
<!-- | |
We sometimes just want a nice looking HTML with | |
the least possible code to embed these bad boys. | |
No load check, nothing, just honest get to action. | |
--> | |
<!-- GOOGLE ANALYTICS --> | |
<script data-id=google-analytics> | |
(function() { | |
const UA = 'UA-XXXXXXXX-X', | |
script = document.createElement('script'); | |
self.dataLayer = [['js', new Date()], ['config', UA]]; | |
script.src = `//www.googletagmanager.com/gtag/js?id=${UA}`; | |
script.async = true; | |
document.head.appendChild(script); | |
}()); | |
</script> | |
<!-- MIXPANEL --> | |
<script data-id=mixpanel> | |
(function() { | |
self.mixpanel = []; | |
self.mixpanel._i = [['TOKEN', void 0, 'mixpanel']]; | |
self.mixpanel.__SV = 1.2; | |
const script = document.createElement('script'); | |
script.async = true; | |
script.src = '//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'; | |
document.head.appendChild(script); | |
script.addEventListener('load', () => self.mixpanel.track('Page View')); | |
}()); | |
</script> | |
<!-- HOTJAR --> | |
<script data-id=hotjar> | |
(function () { | |
self._hjSettings = { hjid: 'SITE_ID', hjsv: 'SCRIPT_VERSION' }; | |
const script = document.createElement('script'); | |
script.src = `//static.hotjar.com/c/hotjar-${self._hjSettings.hjid}.js`; | |
script.async = true; | |
document.head.appendChild(script); | |
}()); | |
</script> | |
<!-- INTERCOM --> | |
<script data-id=intercom> | |
(function () { | |
self.Intercom = { | |
q: [['reattach_activator'], ['update', { app_id: 'APP_ID' }]] | |
}; | |
const script = document.createElement('script'); | |
script.src = '//widget.intercom.io/widget'; | |
script.async = true; | |
document.head.appendChild(script); | |
}()); | |
</script> | |
<!-- SEGMENT --> | |
<script data-id=segment> | |
(function () { | |
self.analytics = [['page'], ['identify', {name: 'Joe Doe'}]]; | |
const script = document.createElement('script'); | |
script.src = '//cdn.segment.com/analytics.js/v1/SOURCE_ID/analytics.min.js'; | |
script.async = true; | |
document.head.appendChild(script); | |
}()); | |
</script> | |
<!-- RAYGUN --> | |
<script data-id=raygun> | |
(function () { | |
self.RaygunObject = 'rg4js'; | |
self.rg4js = { | |
o: [['apiKey', 'RAYGUN_API_KEY'],['enableCrashReporting', true],['enablePulse', true]], | |
q: [] | |
}; | |
const errHandler = self.onerror, | |
script = document.createElement('script'); | |
self.onerror = function (msg, fn, ln, cln, err) { | |
if (errHandler) errHandler(msg, fn, ln, cln, err); | |
self.rg4js.q.push({e: err || new Error(msg)}); | |
}; | |
script.src = '//cdn.raygun.io/raygun4js/raygun.min.js'; | |
script.async = true; | |
document.head.appendChild(script); | |
}()); | |
</script> | |
<!-- SENTRY --> | |
<script data-id=sentry> | |
(function () { | |
const script = document.createElement('script'), | |
DSN = 'PUBLIC_DSN'; | |
script.src = '//cdn.ravenjs.com/3.12.0/raven.min.js'; | |
script.async = true; | |
script.onload = () => self.Raven.config(DSN).install(); | |
document.head.appendChild(script); | |
}()); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment