Hi Jeremy,
Have you any updates or info on getting GA working in your apps?
What kind of events are you tracking?
Does using GA in this manner offer up geographic data like it would for a website?
Thanks.
Hi Jeremy,
Have you any updates or info on getting GA working in your apps?
What kind of events are you tracking?
Does using GA in this manner offer up geographic data like it would for a website?
Thanks.
@fosforus
I’m using it actively in our app Word Slug that’s been out for a little over a month. We’re tracking basic page navigation and some extra event data on points scored per play. Basic stuff to understand how people are using our app.
I’m not 100% convinced that all the data is accurate. There seems to be considerable disparity between what the stores claim as download numbers, what we actually track as “new” players in our database and what GA registers as “new” vs. returning visitors. If that data is off it’s hard to know if the other data is 100% accurate.
It does offer geographic data.
Thanks for the quick reply, Jeremy!
From what I can tell, iTunes App Store numbers relate to “downloads” or “installs” of the app. While the GA data might be tracking the “first launch” of the apps while a user is connected to the web, like Flurry does… so there will be a disparity there, though small.
Apple is a little closed about things like how they measure that you can download an app on your iPad and it will be available to use on your iPhone, too, if they use the same app store acct… does each acct count as one download or each device? We’re in the dark, there.
What I’m wondering is if you need to manually build in calls for things like geographic location (on a country or state level) when using GA, or if it is automatically included when you use the Measurement Protocol. My clients will want to know how many users in Belgium are installing vs Italy, for example.
@fosforus
You do not have to pass the geographic location data yourself. GA will make a best guess (based on cell tower data maybe?). It seems mostly accurate with occasional oddities that I observed while we were in development and I actually knew where all the players were located. GA tracks data for country and state. If you need very accurate data you could use the geolocation and pass the data yourself I believe.
Thanks Jeremy, That’s what I was looking for!
If I add in GA to my apps, I will post up the lua for others to see.
Hi fosforus
Can you please post some code related to GA. how to exactly integrate the GA in corona. I am newbie so have some idea like network.request(“http://google-analytics.com/collect?v=1&tid=”…ga_utmac…"&cid=XXXXXXX&t=pageview&dp=%2Fapp%2Fhome&dt=Home&ul=en_US") how to generate CID for each client i really don’t know. and another thing after this network.request how can i track that or how can i see statistics…???
Thanks in Advance
You’ve got the right idea nilstar. The CID and your evidence of it working are both created/found in the Google Analytics dashboard.
I’ll share some code when I get to work on the project. I’ve had other things in front of it over the last couple of months.
i am having tracking id which generally starts with UA. don’t know about the CID.
so i have done for CID which is mentioned below.
local ga_cid = tostring(math.random(10000000, 99999999))
local function networkListener(e)
if e.isError then
print(“Couldn’t track your application.”)
else
print(“Tracking is going on in GA…”);
print(e.response);
GA=json.decode(e.response);
–[[ for l=1,#GA do
print(“GA…&tid…”…GA[l].tid);
end]]
end
end
network.request(“http://google-analytics.com/collect?v=1&tid=”…ga_utmac…"&cid="…ga_cid…"&t=pageview&dp=%2Fapp%2Fhome&dt=Home&ul=en_US",“POST”,networkListener)
Please tell me it is right or not.
Thanks for your quick reply fosforus
I hope to be able to get deeper into this over the next week.
It looks theres some more info about the CID here:
scroll down to “Step 3. Generate an OAuth 2.0 client ID”
Hi fosforus
Thanks for your quick reply. I am still confused means we need to use CID of Google Play Developer Console,…???
Or it is different for Google Analytics…???
I am really new to mobile app development. I don’t get it really.
Thanks once again for your quick response.
The Google Play Developer Console is different from Google Analytics…it is the Android equivalent to the iOS Developer Member Center.
Alright fosforus
I will sign up for the Google Play Developer Console. and will take the CID of Google Play Developer Console and rest of the code will remain the same. Am i right sir…???
Thanks for your Help…!! Sir
I wish I could tell you for sure… I havent done the CID part yet. We’re trailblazing here.
The CID is a unique identifier for each device that uses your app, not your Google Play app number (if there is such a thing). Google Analytics will use the CID to track the users returning visits and other user engagement metrics.
OK, so it’s like the UID (on an iOS device)?
It looks like we can use system.getInfo( “deviceID” ) to acquire a unique CID for devices.
I’m testing now and will know tomorrow whether or not the events are going to show up on the dashboard.
OK, It looks like it is working! Below is the code I used, and you can use the “Real Time” option in Google Analytics dashboard to see the events happening… in “real time”
First you will need to add a file called ga.lua to your project, and the contents of the file should be as follows:
local ga = {}; -- CALLING THE INIT FUNC WILL ATTEMPT TO LOG A GOOGLE ANALYTICS MEASUREMENT PROTOCOL EVENT IN LIEU OF THE PLUGIN -- FOR MORE INFO, SEE https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#apptracking local track = function(pageName) local ga\_tid = "UA-XXXXX-XX" -- YOUR GA MOBILE APP TID local appName = "myGame" -- Name of your game - w/o spaces or special chars local cd = pageName -- argument sent in function call local ga\_cid = system.getInfo("deviceID") local function networkListener(e) if e.isError then print("GA Tracking unsuccessful") else print("Tracking sent to GA...."); print(e.response); end end network.request("http://google-analytics.com/collect?v=1&tid="..ga\_tid.."&cid="..ga\_cid.."&an="..appName.."&t=appview&av=1&cd="..pageName.."","POST",networkListener) end ga.track=track return ga
Then, at any page or event you wish to track, you include the following at the top of the file:
module(..., package.seeall) local ga = require( "ga" )
Then at the point of the event send the call to the “track” function with an argument describing the page:
-- GOOGLE ANALYTICS ga.track("launchScreen")
This is using the “page view” tracking. I was not able to get the “event” tracking to work properly at this time. Also I’m sure there is a better way to handle the ga.lua object or class…maybe someone can refine it?
Note: In the network request, I used av=1, but you can use whatever version number is relevant to your app.
Hello fosforus sir,
the code is working fine.
Actually i was also getting the same response which i am getting currently.
Difference is just CID. I was not generating CID.
Thanks alot SIr!!!
Hi fosforus
Can you please post some code related to GA. how to exactly integrate the GA in corona. I am newbie so have some idea like network.request(“http://google-analytics.com/collect?v=1&tid=”…ga_utmac…"&cid=XXXXXXX&t=pageview&dp=%2Fapp%2Fhome&dt=Home&ul=en_US") how to generate CID for each client i really don’t know. and another thing after this network.request how can i track that or how can i see statistics…???
Thanks in Advance
You’ve got the right idea nilstar. The CID and your evidence of it working are both created/found in the Google Analytics dashboard.
I’ll share some code when I get to work on the project. I’ve had other things in front of it over the last couple of months.