I am now working on a samsung smart tv app which main purpose is video streaming and I would like to see am I able to track the number of views of difference scenes.
I am new to GA and as far as my understanding, samsung smart tv app hosts the app in localhost
and that can be a problem when using GA.
I have found these maybe-related posts: post1 and post2
The solution from post1 is to use iframe to do the trick, and it works. However for some reasons, I cannot use iframe, so I focus on post2's discussions and solutions.
In post2, the accepted answer bring out two version of GA, and I tried both of them using a dummy localhost html page (For POC purpose). When I check the network, there is a successful request of the 1*1 image, however when I login to GA's admin page, the view number has not changed a bit even in real time analysis.
Sorry for the long background and here's the questions:
Does that mean I have successfully count a page view if there is a request of the 1*1 image?
When registering account of the GA, there is two options: web or mobile app, where web needs you to provide a URL and mobile does not. As my goal is to use GA in a localhost page, I registered the mobile app one, is that correct?
Is there any workaround to use GA in the smart tv app / localhost page without using iframe?
Lastly, here's the script snippet which I place in the last of my head
tag.
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</SCRIPT>
This is the same script copied from my other web projects which has a domain and is working (I have verified using the real time analysis, it updated at once so there should not be a problem of sync time lag...) except I add this statement _gaq.push(['_setDomainName', 'none']);
which is suggested in post2.
Sorry again if these questions are a bit stupid but I have tried my best to do my research before posting the questions. Anyone can give me some ideas? Thanks!
EDITED I just do another experiment which may provide some more clues: As I mentioned, I have another website which have domain and using GA and it's working.
I just tried edit the source code (exactly the one shown above)and open the page with localhost, and in the GA page (GA web account) real time report still count the view number!
Therefore I suspect is it possible that actually the code works, the request has been sent successfully, and the view has been counted, but the GA report page (I am using mobile account) is not map to my localhost page, so I cannot see any report updates ?
If it is true, I would like to ask 2 more questions:
How does the GA report page map to a specific webpage, or app, in this case, my localhost webpage / smart tv app? By the
UA-XXXXX-X
only or URL is needed?As I mentioned I am using the GA mobile account, and seems it cannot show the correct data even if my code is correct and the request successes, what can I do to see the report corresponding to my localhost page? (If I have to register the web version GA account, I have to provide a URL, but mine is localhost/xxx...that's why I registered the mobile one)