Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Release: Google Analytics module
Started by jonjonsson Aug 24 2014 12:14 AM

* * * * * 3 votes
34 replies to this topic
google analytics analytics
[TOPIC CONTROLS]
Page 2 of 2 1 2
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#26

john.cressman

[GLOBAL: userInfoPane.html]
john.cressman
  • Contributor

  • 101 posts
  • Corona SDK

This looks promising.  What happens if the user doesn't have internet?  Does it give an error?



[TOPIC: post.html]
#27

jonjonsson

[GLOBAL: userInfoPane.html]
jonjonsson
  • Corona Geek

  • 1,051 posts
  • Corona SDK

This looks promising.  What happens if the user doesn't have internet?  Does it give an error?

 

No there is no error. Offline events are stored in memory. If the app goes online these events are sent. If the app is released from OS memory the events are lost.



[TOPIC: post.html]
#28

john.cressman

[GLOBAL: userInfoPane.html]
john.cressman
  • Contributor

  • 101 posts
  • Corona SDK

Excellent.  I'm in the process of incoroporating it now but I have a question.  If you leave the isLive as false, will it record events?

 

I'm trying to test it and I know it takes some time for the results to appear in Google but I wanted to make sure that I'm actually SENDING events.

 

In the previewer I'm getting some errors, but I assume that's because it's not on a device.



[TOPIC: post.html]
#29

jonjonsson

[GLOBAL: userInfoPane.html]
jonjonsson
  • Corona Geek

  • 1,051 posts
  • Corona SDK

 

 

If you leave the isLive as false, will it record events?

 

Yes but on your testTrackingID. You can see real time analytics within few seconds.

 

 

 

In the previewer I'm getting some errors, but I assume that's because it's not on a device.

 

Events are tracked on simulator just as it were a real device (but only on testTrackingID, even if isLive = true).

 

What kind of errors?



[TOPIC: post.html]
#30

john.cressman

[GLOBAL: userInfoPane.html]
john.cressman
  • Contributor

  • 101 posts
  • Corona SDK

I got it working!  Looks like it was an ID 10 T error.

 

But I have another question.  How can I specify screens?  I see in Google analytics that it tracks screens, but how do I tell it when it's hit a new screen?

 

Thanks!  This REALLY helps me!



[TOPIC: post.html]
#31

jonjonsson

[GLOBAL: userInfoPane.html]
jonjonsson
  • Corona Geek

  • 1,051 posts
  • Corona SDK

But I have another question.  How can I specify screens?  I see in Google analytics that it tracks screens, but how do I tell it when it's hit a new screen?

 

 

You use:

ga.enterScene("my screen name")

So with composer you could do:

function scene:show( event )
    if ( phase == "will" ) then
     
    elseif ( phase == "did" ) then
        ga.enterScene("my screen name") -- or ga.enterScene(composer.getSceneName( "current" ))
    end
end


[TOPIC: post.html]
#32

fosfor

[GLOBAL: userInfoPane.html]
fosfor
  • Enthusiast

  • 39 posts
  • Enterprise

Thanks JonJonsson for this great plugin!

 

Here's something to be aware of if you are having a problem with the analytics working fine in the simulator but not working on devices. It is not a problem with the plugin. It is something that can happen in the GA dashboard quite easily if you click on the wrong thing.

 

When you test in the simulator and look at the Real-time events or Overview in GA, you'll see something like this:

ga1.png

 

That means it is working fine from the simulator.

 

If you happen to click the red-orange square next to DESKTOP or click the 100% bar, GA will create a FILTER to view ONLY Desktop users. Any subsequent testing you do on real mobile/tablets will NOT show up until you dismiss the filter.

 

Here is what the filter looks like:

 

ga2.png

Events from Mobile or Tablet devices will not show up until you click the X in the blue button to dismiss the DEVICE CATEGORY: Desktop filter.

 

This drove me crazy for a couple of hours, so I thought I'd share.

 

Cheers!



[TOPIC: post.html]
#33

eder1602

[GLOBAL: userInfoPane.html]
eder1602
  • Observer

  • 14 posts
  • Corona SDK

 It is works for me! 

 

ga.init({
    isLive = false, 
    testTrackingID = "UA-0000000",  -- <-- Replace with your tracking code. If code is wrong it fails silently.
    debug = true,
})

In alpha and beta tests, this work only "Real time"?

 

And this "debug =true", I need change to "debug=false", when the app will go to production?

 

Thanks! 



[TOPIC: post.html]
#34

fosfor

[GLOBAL: userInfoPane.html]
fosfor
  • Enthusiast

  • 39 posts
  • Enterprise

 

 

And this "debug =true", I need change to "debug=false", when the app will go to production?

 

 

 

For production, you will need to change debug to =true and you will want to add productionTrackingID = '[your real tracking code]'

 

If you have been using your production tracking code to test with, then the testTrackingID and the productionTrackingID would be the same. JonJonnson has provided the option to use different codes for testing and production as a convenience, but using the same one works fine too.



[TOPIC: post.html]
#35

joedavinci

[GLOBAL: userInfoPane.html]
joedavinci
  • Enthusiast

  • 48 posts
  • Corona SDK

That is weird! It's just a POST network request. Very basic stuff, should just work everywhere one would think :)

i was putting GA into a new app i'm finishing now and managed to test this again.

It is only a problem of running on the Corona Simulator in Windows environment.

 

if it's Corona on Mac Os X, it does show up in GA normally.. just in windows..
but no problem, since I know this, it doesn't bother me anymore :)




[topic_controls]
Page 2 of 2 1 2
 
[/topic_controls]