Skip to content

Commit

Permalink
Updating error tracking example
Browse files Browse the repository at this point in the history
  • Loading branch information
j-beckman committed Jul 24, 2014
1 parent a919138 commit 46392ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
}
</style>
<script type="text/javascript">
// gatrack.js error-tracking setup
(function(g,a,t,r,a,c,k){g[r]=g[r]||{};g[r][a]=t.getTime();g[r][c]=[];g[c]=function(m,u,l,c,e){this.gatrack.onerror.push([m,u,l,c,e])}})(window,document,(new Date()),'gatrack','timer','onerror');

// Google Analytics
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(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', 'UA-XXXXXXXX', 'example.com');
ga('create', 'UA-XXXXXXXX', 'example.com'); // Replace this with your own GA property ID to see it work.
ga('send', 'pageview');
</script>
<script type="text/javascript"
Expand All @@ -34,6 +38,7 @@
<div id="hover-div">
<div class="container">
<h3>Hover over me!</h3>
<h3>Or, click me.</h3>
</div>
</div>
<script type="text/javascript">
Expand All @@ -44,6 +49,11 @@ <h3>Hover over me!</h3>
});
};
gatrack.click(document.getElementById('hover-div'));

// Let's trigger an error (and see it sent to GA):
setTimeout(function(){
console.log(foo);
}, 3000);
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Is it any good?

You betcha. Check out the [provided index.html](https://github.com/jbckmn/gatrack.js/blob/master/index.html) or [demo](http://gatrack.andjosh.com) for working examples.
You betcha. Check out the [provided index.html](https://github.com/jbckmn/gatrack.js/blob/master/index.html) demo for working examples.

## Way-cool:

Expand Down

0 comments on commit 46392ad

Please sign in to comment.