Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google analytics for HTML inside ios native app

I've build an ios application that is having static HTML pages. I'm using uiwebview to create container for my HTML pages.

Now I want to use google analytics for my pages. I've downloaded its SDK and it is working. Now I would like to track events on some of buttons on HTML page. If use below code

var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<Acc no>']);

(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);
})();

Along with _gaq.push(['_trackEvent',...) not tracking required event.

Can I do pagetracking with SDK and event tracking in normal web HTML method?

like image 985
Chinmayee G Avatar asked Sep 06 '12 06:09

Chinmayee G


1 Answers

You should implement the Google Analytics native SDK and make it react using the UIWebviewDelegate or Javascript events.

like image 78
Thibaut LE LEVIER Avatar answered Nov 03 '22 19:11

Thibaut LE LEVIER