I\'m trying to integrate Google Analytics in my Smart TV Application.
It is a Javascript based application, and I have tried all the solutions available on the Samsu
So you need an iframe to put the file with GA snippet inside. The file must be on remote server, because Samsung Smart TV apps works on localhost and GA ignore calls from local.
From the GA snippet you can remove the line, if you don't want GA to count trackPage on iframe load.
_gaq.push(['_trackPageview']);
Then in the main script you add this function:
var trackPage = function(url) {
if (window.ga && window.ga._gaq)
window.ga._gaq.push(['_trackPageview', '/samsung' + url.replace(/ /g, "_")]);
};
So calling for example trackPage("/sports/football/barcelona chelsea")
somewhere in the app will produce GA track page with exact url:
/samsung/sports/football/barcelona_chelsea
It is very efficient - you can play with GA Real time and you can see how nice it works. As GA works asynchronous the iframe never gets reloaded.