Skip to content

Instantly share code, notes, and snippets.

@Vidarls
Created February 12, 2016 07:49
Show Gist options
  • Save Vidarls/97ef713c82d4d15607ff to your computer and use it in GitHub Desktop.
Save Vidarls/97ef713c82d4d15607ff to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="styles/style.css">
<!-- Normal Raygun snippet-->
<script type="text/javascript">
!function(a,b,c,d,e,f,g,h){a.RaygunObject=e,a[e]=a[e]||function(){
(a[e].o=a[e].o||[]).push(arguments)},f=b.createElement(c),g=b.getElementsByTagName(c)[0],
f.async=1,f.src=d,g.parentNode.insertBefore(f,g),h=a.onerror,a.onerror=function(b,c,d,f,g){
h&&h(b,c,d,f,g),g||(g=new Error(b)),a[e].q=a[e].q||[],a[e].q.push({
e:g})}}(window,document,"script","//cdn.raygun.io/raygun4js/raygun.min.js","rg4js");
</script>
<title>My Aurelia Site</title>
</head>
<body aurelia-app="main">
<div id="splash-screen">
<p>Loading, please wait..</p>
</div>
<!-- Raygun initialization code-->
<script type="text/javascript">
rg4js('apiKey', 'super secret');
rg4js('attach', true);
rg4js('enableCrashReporting', true);
rg4js('enablePulse', true);
</script>
<!-- Using bluebird for promises, cause Edge and IE promises are horribly slow-->
<script src="//cdn.jsdelivr.net/bluebird/3.1.1/bluebird.min.js"></script>
<script src="jspm_packages/system.js"></script>
<script src="config.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
import {inject} from 'aurelia-framework';
import {EventAggregator} from 'aurelia-event-aggregator';
/*
* Main application view model
*
* (Or any other place that is executed *once*
* in the application lifetime, that can access the event aggregator)
*/
@inject(EventAggregator)
export class App {
constructor(ea) {
this.ea = ea;
// The router publishes events during the routing process
// use the success event to trigger the SPA virtual page
// logging of Raygun.
this.ea.subscribe('router:navigation:success', _ => {
Raygun.trackEvent('pageView', {
path: '/' + location.hash
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment