-
Notifications
You must be signed in to change notification settings - Fork 2
/
analytics_web_view.html
27 lines (22 loc) · 1.1 KB
/
analytics_web_view.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!-- adapted from http://www.blastam.com/blog/index.php/2013/07/ga-universal-analytics-phonegap-mobile-apps/ -->
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script src="cocoon.js"></script>
<script>
Cocoon.App.forward("console.log('Hello from the WebView');");
// Disable the input in CocoonJS (we do not want to have both input in CocoonJS and the WebView)
Cocoon.Touch.disable();
// Loading local 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','analytics.js','ga');
// Once we're loaded, we can inform the Canvas+ view that it can
// start sending stuff
Cocoon.App.forward("console.log('Analytics interface ready, informing parent');");
Cocoon.App.forward('window.gaInterfaceIsReady()');
</script>
</head>
</html>