Google Analytics - confusion over v2, v3, opening new accounts

I have integrated Google Analytics in my app, and it is certainly more info (I also have Flurry).

Oddly out of all of these, I find AppBrain new installs and DAU graphs to be much more reliable or believable (may not be true - but I wind up looking at AppBrain console repeatedly during the day to check how downloads are going after an upgrade etc.).

Anyway, coming to the question about Google Analytics - I have integrated Tapjoy in an app, and I would like to “double-check” user earning of Tapjoy coins etc. - for that I thought maybe use Google Analytics Events or their Ecommerce. It seems Events would suffice - as it has these settings:

https://developers.google.com/analytics/devguides/collection/android/v2/events
String Category
String Action
String Label
Long (Optional) Value

https://developers.google.com/analytics/devguides/collection/android/v3/events

This seems like it will be good way to record the coins earned by user (note there is no per-user detail I would be storing - just as something to compare with Tapjoy revenue numbers).

Am I correct in thinking this would be usable this way - so far I am not sure how this will look like in Google Analytics (how it will show this string/long data).

Secondly, I am a little confused by the v3 and v2 versions of the help (v2 seems much simpler). I think the Google Analytics .jar file I downloaded is v2 (maybe Google has updated to v3 now).

However I can’t find a “download SDK” section on the Google Analytics webpage. The last time I got a link to download SDK .jar file was when I set up an app. Their help also suggests that’s when .jar link will be shown.

However I go into Admin and it shows:
Account/Property/View

And I try to create a dummy Account - but it seems to be editing one pre-existing one - I already have 3 accounts (2 are working with 2 apps, and 1 is for an upcoming app).

At least this was my naive understanding - it turns out their help now suggests that there maybe a limit to the number of accounts (it has language like “before you run out of accounts” etc. ??). And it suggests that different apps should be added as a “Property” (and not as an Account I presume). And for same app can add Android/iOS as different “Views” for that Property.

Obviously I have underread their explanation (if there was one when I signed up) - and I and Google Analytics are on different pages about how to organize apps/variants etc.

I would also like to get a link to a Google Analytics SDK - since it is not obvously visible (maybe it is wearing a Harry Potter cloak).

Any help would be appreciated !

https://developers.google.com/analytics/devguides/collection/android/resources

The v3 version is 2.8MB and the v2 is 206KB (10x smaller) - do you have an opinion in whether it is ok to keep using v2 for now ?

Thanks.

Is 3 the max number of “Accounts” one can have ?

The v3 .jar is only 880kb…
I think you can keep using v2, it’s not deprecated yet…
Don’t know about number of accounts

To answer part of your question - you can have Accounts, Properties and Profiles.

Generally you should create a new property for each app or website you want to track.

Each property is created within a particular account. For example, I keep all my app properties under a single account titled “Android apps”, while my websites are under a separate account. This is mainly to help with organisation and granting permissions to additional users. I believe the limit to the number of accounts you can have is about 10 (I’ve reached it before!)

Ultimately the Property is what matters for your app. This is what has a unique tracking code / ID.

Profiles allow you to further filter the data which is tracked for a particular property. Don’t worry about this for now - it will only complicate things :slight_smile:

Hopefully this helps make some sense of the terminology! Google Analytics is an incredibly powerful product, so there can be a lot to learn. To date I’ve been using the SDK v2 with no problems. Haven’t looked at v3 yet.

Edit: I just reread your post, and noticed you mentioned “Views”. I think these are the equivalent of Profiles, but not 100% sure on that. They may have changed things a bit with the new interface.

I couldn’t get v3 working. It was throwing a bunch of errors, so i just switched back to v2 for now.

Unlesss there are some major improvements like search terms data coming from app store, it doesnt make any sense to upgrade now.

This is exactly the kind of feedback I was looking for - “what works and what doesn’t” - I guess I will stick to v2 for now.

The example they give for “Views” is that same app on Android and iOS - so you make different Views for that.

With Accounts - I’ll check that out again - but superficially I was having trouble understanding manage the accounts etc.

Do you folks think using the Events is an appropriate use for keeping track of Tapjoy earnings/buys etc. by the user (since it would be an arbitrary String/long combination I am unsure how Google Analytics will show/display it as - but will implement it and see.

Hmm, I suppose that’s one way to use it. I just logged in and got a message today - they’ve renamed “Profiles” to “Views” as part of the new interface migration: [UA] About views - Analytics Help

So you have:

  • Account - a group of sites or apps
  • Property - an individual site or app
  • Profile/View - (optional) a filtered view of the data in a Property

Yes, I would think that’s a good way to track the earnings. Just make sure you track the amount earned for each action, and don’t send the entire balance to GA. For example:

  • The user starts with a a balance of $2.10.
  • They earn $0.03 with Tapjoy. An event is sent to GA with the value of “0.03”
  • The balance is now $2.13. (don’t send this balance in an event!)

Because Google Analytics will look at the whole set of events it’s received, and tell you the overall “value” (or “sum”) of these events. If you start sending the user’s balance multiple times, this will mess up the value calculations and your tracking won’t be much use.

I tested that for sending Tapjoy “new earnings” to Google Analytics and the “long” value is actually SUMMED (as you suggest).

Recapping - they label an event with: Category, Action, Label (optional), Value (optional).

So after sending a few events, when you check Google Analytics Developer Console, you can see the events displayed in this way:

  • total number of events

  • the various category of events are listed (this would be every unique category you have used in sending an event)

  • if click on a category - it shows the variety of actions - this would be every variety of action you have used in sending an event

  • if click on an action - don’t see the constituent individual events (so it is not like a log of events)

In both the category view where actions are shown and in the action - in both you can see the “long” value as a SUM of the values sent so far. And the average value. There is no graph for showing the distribution of values etc. So ideally you would only use this to send very simple info like the price of a product that was bought (say) - here the price should not change, but ideally if it is constant then the total value and the average really don’t tell you very much.

For a more complex use - where your product price fluctuates (for example sometimes on sale etc.) - then I am guessing the ideal way to use would be to use a different “action” varient for that sale product.

This because if you started sending varying “long” values for the same “action” - Google Analytics will only remember an average etc. and not any further detail about it’s distribution etc. (so ideally not send more info detail/complexity than Google Analytics is capable of displaying/remembering).

This is the code I used to send an event - let’s suppose for the Tapjoy earnings that user has just done - from the Tapjoy callback that gets info about user having earned X number of coins:


public static void sendEarned(long earnedAmount) {

	String category = "Tapjoy";
	String action = "Earned";
	String label = null;
	long value = earnedAmount;

	// https://developers.google.com/analytics/devguides/collection/android/v2/events
	if (EasyTracker.getTracker() != null) {
		EasyTracker.getTracker().sendEvent(category, action, label, value);
	}

}

I’d suggest utilizing “Label” dimension as well.
Click on Action works as drill-down to Label dimension. You need to provide non-null label values for this to be working.

So one could use different labels to identify say a product being bought … and same product being bought while it was on sale etc.

EDIT: I am now using it this way (for unlocking features within an app):


category = "Store";
action = "Buy";
label = "Product1";
value = price;

// https://developers.google.com/analytics/devguides/collection/android/v2/events
if (EasyTracker.getTracker() != null) {
	EasyTracker.getTracker().sendEvent(category, action, label, value);
}

You seem to be close to google analytics ecommerce / transaction tracking. I’d keep event tracking, as you have implemented it, but would also add transaction tracking. This provides out of the box reports such as distribution of days-to-transaction and sessions-to-transaction, product performance, conversion rate and similar. These reports may be hard (or impossible?) to get using event tracking solely.

However, I have not much experience with ecommerce, as I have no IAPs currently.

You mean Ecommerce gets you some more complicated analysis results (than Event).

I have not understood what the “transaction id” is for Ecommerce - they say it has to be unique - does that mean unique across all users, or unique from what ?

How do I generate a unique string that is not by-chance same as being used by another user (use android ID plus some other local string or what ?).

Or is it something to be created on Google Analytics Developer Console ?

Yes, you get some more complicated and useful reports, available straight away under regular reporting, if you use ecommerce.

Regarding transaction ID, my testing showed, there is no such requirement as unique transaction id across users. Also, I think there is no feature on Google Analytics Developer Console that would generate transaction IDs for us.

I suspect that nothing goes wrong, if some constant label (such as “TR-0001”) is used for transaction id. Though, there is one report being affected: Transactions. As transactions are grouped by transaction ID, all sales gets listed and summed up in one line in this report.

Here is transaction tracking part from my singleton class wrapping google analytics calls, I was experimenting with:


	private int mTransactionId = 0;				// transaction id for e-commerce tracking
	private static final long M = 1000000;				// conversion to micros for e-commerce tracking

	public void trackItemPurchase(double item_price, long quantity, String affiliation, double tax_percent, double costs_total, String item_id, String item_name, String item_category)
	{
		mTransactionId++;
		Transaction myTrans = new Transaction.Builder(
			"T"+String.valueOf(mTransactionId),				// (String) Transaction Id, should be unique.
			(long) (item_price*quantity*M))					// (long) Order total (in micros)
			.setAffiliation(affiliation)					// (String) Affiliation
			.setTotalTaxInMicros((long) (0.01*tax_percent*item_price*quantity*M))		// (long) Total tax (in micros)
			.setShippingCostInMicros((long) costs_total*M)	// (long) Total shipping cost (in micros)
			.build();
		
		myTrans.addItem(new Item.Builder(
				item_id,							// (String) Product SKU
				item_name,							// (String) Product name
				(long) (item_price*M),				// (long) Product price (in micros)
				(long) quantity)					// (long) Product quantity
				.setProductCategory(item_category)	// (String) Product category
				.build());
		
		mGT.trackTransaction(myTrans);
		
	}

FREQUENCY OF DATA UPLOAD to Google Analytics servers

The settings in res/values/analytics.xml:

<integer name=“ga_dispatchPeriod”>30</integer>

That one can use for testing i.e. interval of time after which data to be sent to server should be 30 seconds. If remove this for production, it will revert to 30 minutes.

The question is, what if the app is only used once for a minute - will the app have to be run again at which point Google Analytics will realize that 30 minutes has elapsed (at least) and now the data can be sent to Google Analytics servers ?

Does this mean that if we set the interval NOT to 30 seconds but to 30 minutes we may not get data for apps which are run only once ?

Or is the data sent ANYWAY when the app is exiting ?

Anyway, if you want to provide across-users-unique identifier, there is good answer to this question: use UUID. I am using this technique for other purposes (not for google analytics or transaction tracking).

Here is a link to Android Developers Blog with problem description and solution with UUID and “installation” file:

Identifying App Installations | Android Developers Blog

And there is question, what if user uses your app primarily offline, or uninstalls it before going online. I have no idea, what is going on in the background, how requests are being packed and when they are sent. In spite of all, tracking seems to work very reliable. I am using 420 seconds dispatch period.

I guess if the “transaction id” is supposed to be “unique” - they may mean that it should be unique for the app (or more accurately for the user), but different from one call to next. Perhaps the reason it works with the same static one is because it sees it as the same thing (i.e. as corrections of same one global transaction ?).

Maybe what Google means is a “transaction ID” in terms of a financial transaction - where one could generate one and save it to local Shared Preferences - then increment it each time to get a new one.

However, that would not make sense as it would not be universally unique - and doesn’t make sense in the context of using it to signify anything on Google Analytics Developer Console.

Then perhaps they really do mean a universally unique code - so this may ideally be used with app querying your server which returns a globally/universal unique code (incrementing it each time) to the user/app - the app then uses that to construct the Google Analytics transaction (?).

The transaction id maybe related to some Google Play Payments id which maybe unique (?)

I think it may work, but it is amazing that Google spends so little time explaining it’s stuff - compared to many smaller ad companies.

EDIT: just look at the language in this help document:

https://developers.google.com/analytics/devguides/collection/android/v2/ecommerce

Quote:
0_123456", // (String) Transaction Id, should be unique.

“should be unique” … from WHAT ???

It’s like saying something should be “similar to” without saying what it should be similar to … !

Yes it is definitely under-explained. But I am pretty sure, you don’t lose much, if you use constant id for all transactions. You only lose list of transactions, everything else, I suppose, should work correctly.

You don’t have to query your server to provide globally uniqueness. UUID is string generated locally, with sufficiently high probability of being globally unique. That is the charm of these methods. Link, I’ve posted above, deserves to be studied a bit :slight_smile:

One way to do it would be just to generate one based on time of day (milliseconds) - convert that long to string and add your ANDROID_ID at the end of that.

While you WOULD lose time-precision - since time of day may vary (if user’s device has the wrong time - maybe showing a time from the year 2000) - but for most cases would be serial and reasonably unique.