alebianco / ANE-Google-Analytics

Air Native Extension for Google Analytics on iOS and Android
http://alebianco.github.io/ANE-Google-Analytics/
MIT License
133 stars 44 forks source link

Tracking doesn't work in APK built in FlashBuilder 4.6 (AIR 3.8, android) #25

Closed denysaw closed 10 years ago

denysaw commented 10 years ago

Hi, Ale! I'm trying to use your GA ANE in AIR/android FlashBuilder project. Doing all strictly the same way as you described in guide. Testing in standalone emulator(BlueStacks) and on real phone(by re-installing released APK). On GA using Mobile App Data tracking profile, not Universal one for sure.

Analytics.isSupported() shows true, but tracking doesn't work nor in Real-time overview nor on usual dashboard.

ANE is connected to project: http://puu.sh/4Sarx.png SWC(NativeGATracker-v2.0.4.swc) lays in /libs

Some code key moments (maybe something I'm doing wrong):

import eu.alebianco.air.extensions.analytics.Analytics; import eu.alebianco.air.extensions.analytics.api.ITracker; ... var tracker:ITracker = Analytics.getInstance().getTracker(GA_TRACK_ID); tracker.buildView("Home").track();

Tried: tracker.startNewSession(); , tracker.buildView("Home").create(); etc. Nothing helps.

Maybe it's unreal to build with FB, dunno. Tell me please what could it be! Thanx!

alebianco commented 10 years ago

I don't have FB installed to try it, but it souldn't make any difference I don't really know about the "real time" section on the dashboard, it should display your data but i honestly never tried it much. What I often noticed is that the dashboard is setup to display the hits of the last weeks up until "yesterday". Are you positive that in the "overview" screen today's data is selected and no data shows up?

also: the extension says it's supported on the bluestack emulator? just curious, never tried it ...

denysaw commented 10 years ago

I tried a lot on real phone too, so I can't say will it work on BStacks or no, but it says it's Supported(isSupported() returns "true") even on BlueStacks.

I thought too, that maybe real-time section won't work for Mobile App Profile, but already 4 days passed and NO info on usual dashboard (0 visits, etc.)

I used GaForFlash (http://code.google.com/p/gaforflash/) before trying to use your extension. But it worx just with Universal Tracking, I need Mobile App one :(

-- amended to remove link to copyrighted material --

But I think there's some difference, cuzz I didn't make any steps from: https://github.com/alebianco/ANE-Google-Analytics#building No .jar/.h, no user.properties.eg, no build.ant. Cuzz FB has no such files at all, just xml's of app and android xml manifest. So I've just connected ANE to the app and moved NativeGATracker-v2.0.4.swc to /libs (tried without it too, all the same).

So if you would have a chance to try to build it on FB, it would be uber-great news for me ;) Thank you anyway!

alebianco commented 10 years ago

The information on building is just for people interested in fiddling with the code and manually rebuild it ... and a reminder for me. You don't need it, if you just want to use the extension all you need is the compiled ane file.

Can you set the extension in debug mode and then check the device logs to see if there're any entry with the tag GAV2 or ANE ?

denysaw commented 10 years ago

Aha. Clear. Ok, will try debug mode log on phone in monday. Thanx!

chatmurai commented 10 years ago

Hi @alebianco,

I just tested your ANE on iOS and Android devices (iOS 7, Android 4.3), using AIR 3.9 + Flash Builder 4.7 and I had a look to devices logs as you suggested to @denysaw , but I found nothing related to GAV2. Each call to ITracker methods falls silently.

denysaw commented 10 years ago

WoW. Thank you, I hadn't time to check logs today. So same problem, yep?

chatmurai commented 10 years ago

Yep same. I had a look in at the project sources and tried to figure out what was going wrong, but I'm not that good at Java and Objective-C !

denysaw commented 10 years ago

Same here ) Then we'll be praying to Alebianco De Creator ;) And hope, that it's fixable at all ;)

alebianco commented 10 years ago

not even generic errors in the logs? and it happens on both iOS and Android? ps: you may want to use an earlier version while I investigate

denysaw commented 10 years ago

If it'll take couple of days - I can wait. Wanna use latest build ;) Thanx!

alebianco commented 10 years ago

Got some news guys.

The tracking DOES work and the real time view on analytics does show the right amount of information in (nearly) real time. The normal overview page takes a bit longer to show the data, like 5-10 minutes.

The problem is the delay between when you track the data and the time it's actually sent to the servers. There's a 180 seconds delay between dispatches to the server, everything you track between those "windows" is stored locally. Of course the store is persistent, so if you quit and reopen the app the store will be cleared and dispatched immediately ... BUT during development if you stop and run it again from the IDE, the app will be uninstalled and re-installed, clearing the local store in the process, so every queued hit WILL be lost.

my suggestion: during development set the dispatching time to a lower setting, like 5 or even 0 seconds. or dispatch hits manually. Be considerate and DON'T do it in the production release, potentially it's a battery drainer.

Let me know if this works for you as well or if the problem persist

denysaw commented 10 years ago

Hi, Ale! Hm... So you did all those things with APK built in FB? For me problem 100% persist. I've waited a lot more, than 180sec )) 10 mins and 0 visitors in Real-Time and same zero in usual Dashboard. So for me tracking doesn't work :(

alebianco commented 10 years ago

you waited 10 minutes with the app running? try checking out my demo project https://github.com/alebianco/ANE-Google-Analytics-Demo and see if you get some data from that one instead

denysaw commented 10 years ago

"you waited 10 minutes with the app running?" - Sure running, yep ) I tried, the same. So have you tried it to build with FlashBuilder?

alebianco commented 10 years ago

Nope, as I said, I don't have a license for FB, so I can't try. It should make no difference what IDE do you use (and if it does, throw FB out of the window) and the extension itself is working fine from what I can see.

Try sending me an email and detail the project setup, flex/air versions, details on the analytics profile etc, everything you can think of. Let see if i can help you out anyway.

@vincentmaitray what about you? still problems?

chatmurai commented 10 years ago

Hi @alebianco, sorry for the delay but as I am about to release my app on both iOS and Android platforms, the past days have been sleepless.

To be honest I had no time to test again your library, and I temporarily switched to the native Google Analytics SDK, which is a pain. As soon as the app is submitted to Apple & Google, I'll give it a try again, because as I said earlier, your implementation is way much cool ;-)

denysaw commented 10 years ago

"Nope, as I said, I don't have a license for FB, so I can't try." You can try trial one. Or use crack just for test.

App xml contains: eu.alebianco.air.extensions.analytics.NativeGATracker Flex SDK version: 4.6.0 AIR SDK version: 3.8 On GA: "All Mobile App Data" tracking profile. No customizations. Using 100% it's trackID.

alebianco commented 10 years ago

did more tests with the same flex and air sdk, still can't see the problem. I'll try with FB, but it's going to take some time get it up and running. In the meantime, can you check two things: 1) the android logs, through the monitor app, you should see something like this https://gist.github.com/alebianco/7229718 (tracking a string, dispatch time set at 45sec) 2) is the extension packaged into the app? there should be a setting screen like this http://developer.blackberry.com/air/files/documentation/images/bb10sdkgsgane.jpg with the extension ticked

denysaw commented 10 years ago

Ok. Will check logs. I sent you in 1st post screen with those settings: http://puu.sh/4Sarx.png Thank you. Hope you'll find a time to check it.

SBRK commented 10 years ago

I'm experiencing the same problems... In the logs I have : Unable to read a property, falling back to default value. (Exception:[name:NullPointerException, reason: null, method:TrackData:trackEvent]

SBRK commented 10 years ago

I uncommended these in the app.xml and it seems to be working now...

android.permission.READ_PHONE_STATE android.permission.ACCESS_NETWORK_STATE android.permission.ACCESS_WIFI_STATE

It would be cool to say in the wiki which permissions are needed for the ANE

alebianco commented 10 years ago

good point @SBRK the analytics sdk for android (https://developers.google.com/analytics/devguides/collection/android/v2/) requires android.permission.INTERNET and android.permission.ACCESS_NETWORK_STATE as they're defined in my demo project (https://github.com/alebianco/ANE-Google-Analytics-Demo/blob/master/build/descriptor.xml).

can't remember if AIR has a predefined set of standard permissions, but in any case is best to specify them explicitly. I'll add the info to the docs.

PS: that log message is not really relevant to this issue or the app permissions, it just depends with which data you're creating your event

denysaw commented 10 years ago

Heh, really guys! Thank you a lot! All was in ACCESS_NETWORK_STATE permission missing. Better to write it same BIG letters on wiki page so users would know. So it's not issue, all worx great. Thank you for support! BYE!

chatmurai commented 10 years ago

Glad to hear this ! I'll give it a try with the next project I am beginning on next monday ! Thanks for your work again.