Implementing google analytics for android app -
how implement google analytics android app?
(i need basic code searched lot of websites didn't understand please me)
thanks in advance..
https://developers.google.com/analytics/devguides/collection/android/v3/ link guide you.
http://dl.google.com/googleanalyticsservices/googleanalyticsservicesandroid_3.02.zip download jar analytics link. put in in libs.
https://www.google.com/analytics/web/ , use create account analytics @ location. , create new app in it. use analytics app id below.
and use below code in each of activity.
public void trackevent(string category, string action, string label, long value) { // todo auto-generated method stub easytracker easytracker = easytracker.getinstance(this); easytracker.send(mapbuilder.createevent(category, action, label, value).build()); } public void onstart() { super.onstart(); easytracker.getinstance(this).activitystart(this); googleanalytics.getinstance(this).gettracker(your_analytics_id); } @override protected void onstop() { // todo auto-generated method stub super.onstop(); easytracker.getinstance(this).activitystop(this); }
use trackevent method track events.
this answer based on v3, v4 can used using google play services library.
ok. here trick.
create xml file analytics.xml in values folder.
<resources> <!-- replace placeholder id tracking id --> <string name="ga_trackingid">google_analytics_id</string> <!-- enable automatic activity tracking --> <bool name="ga_autoactivitytracking">true</bool> <!-- enable automatic exception tracking --> <bool name="ga_reportuncaughtexceptions">true</bool> </resources>
i hope helps u.
Comments
Post a Comment