Discussion Forums  >  Uncategorized

Replies: 2    Views: 275

pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
07/16/11 01:20 AM (14 years ago)

Google Analytics (android)

I think I figured it out (using the GoAn SDK for android, as opposed to just embedding something on an HTML page). Will report back soon if I can verify! I noticed there's no discussion on here of how to do it :/
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/16/11 02:24 AM (14 years ago)
Nevermind. Hit a wall. It's NOT intuitive at all. I get as far as embedding this in the manifest: <activity android:name=com.google.android.apps.analytics.sample.TestActivity android:launchMode=standard> <intent-filter> <action android:name=android.intent.action.MAIN /> <category android:name=android.intent.category.LAUNCHER /> </intent-filter> </activity> After than though, every single guide I've found ist just a ripped off variant of the one on the google dev blog, and that one isn't very clear. I'm getting the impression most of these people posting online with instructions don't honestly have it set up themselves and are just going for the content farm effect. Either way, the general idea I'm getting is I'm supposed to put this: package com.google.android.apps.analytics.sample; import com.google.android.apps.analytics.GoogleAnalyticsTracker; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class TestActivity extends Activity { GoogleAnalyticsTracker tracker; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); tracker = GoogleAnalyticsTracker.getInstance(); // Start the tracker in manual dispatch mode... tracker.start(UA-YOUR-ACCOUNT-HERE, this); // ...alternatively, the tracker can be started with a dispatch interval (in seconds). //tracker.start(UA-YOUR-ACCOUNT-HERE, 20, this); setContentView(R.layout.main); Button createEventButton = (Button)findViewById(R.id.NewEventButton); createEventButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { tracker.trackEvent( Clicks, // Category Button, // Action clicked, // Label 77); // Value } }); Or this: GoogleAnalyticsTracker tracker; protected void onCreate(Bundle savedInstanceState) { ... tracker = GoogleAnalyticsTracker.getInstance(); tracker.start(“UA-1234-1”, this); … } in the APPROPRIATE locations. Which, I have no idea what these mythical and undefined locations are. I can't even get the text colors in eclipse to show up right for them. Any ideas? Llinks for the dev thing: http://code.google.com/mobile/analytics/docs/android/ http://android-developers.blogspot.com/2010/12/analytics-for-android-apps.html
 
pandafloski
Aspiring developer
Profile
Posts: 67
Reg: Jun 22, 2011
Austin
670
like
07/17/11 05:36 PM (14 years ago)
no ideas?
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.