Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 8

Google Analytics

I want use Google Analytics in my Roku client app to track user events and get geographical info about my users.

We use them in our Silverlight client applications via javascript by calling the trackEvent() function as follows.

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UID_HERE");
pageTracker._trackPageview();
} catch (err) { }
</script>

<script type="text/javascript">
function trackEvent(category, action, label) {
try {
pageTracker._trackEvent(category, action, label);
} catch (err) { }
}
</script>

Is there any way we can do this in the roku client? Perhaps some direct HTTP asych query method?

Thanks

Tom
0 Kudos
2 Replies
Highlighted
Level 8

Re: Google Analytics

Additionally it looks like a lib was written for this sort of thing in Flash apps even when the HTML DOM is not available.
http://code.google.com/apis/analytics/d ... icsLibrary
0 Kudos
Highlighted
Level 9

Re: Google Analytics

You can certainly do direct HTTP(S) transfers to do your logging. To do so, look at the very end of the "RokuDvp-ComponentReference.pdf" documentation in the SDK for the documentation for roUrlTransfer. You can use this to do HTTP GET and POST if you want to send data back to your server.

We don't however, support any JavaScript execution.

Patrick
0 Kudos