Skip to content

Instantly share code, notes, and snippets.

@andrewconnell
Created September 9, 2015 10:41
Show Gist options
  • Select an option

  • Save andrewconnell/b2a780a8359f2b81c36b to your computer and use it in GitHub Desktop.

Select an option

Save andrewconnell/b2a780a8359f2b81c36b to your computer and use it in GitHub Desktop.
Application Insights Snippet
<script type="text/javascript">
var appInsights=window.appInsights||function(config){
function s(config){t[config]=function(){var i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},r=document,f=window,e="script",o=r.createElement(e),i,u;for(o.src=config.url||"//az416426.vo.msecnd.net/scripts/a/ai.0.js",r.getElementsByTagName(e)[0].parentNode.appendChild(o),t.cookie=r.cookie,t.queue=[],i=["Event","Exception","Metric","PageView","Trace"];i.length;)s("track"+i.pop());return config.disableExceptionTracking||(i="onerror",s("_"+i),u=f[i],f[i]=function(config,r,f,e,o){var s=u&&u(config,r,f,e,o);return s!==!0&&t["_"+i](config,r,f,e,o),s}),t
}({
instrumentationKey:"c0a3dcd4-6b58-4f92-a053-54d65a1db105"
});
window.appInsights=appInsights;
// appInsights.trackPageView();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment