4

I'd like to use Google Analytics to track usage of a command line Node app. Tracking will be strictly opt-in. I'd like to track basic usage, plus which operating system and version of Node was used.

I've found the Measurement Protocol, but I'm wondering whats the best way to set up Google Analytics.

You can choose from Web or App - App seems the best fit, but then I'm sent to Firebase to set up an iOS, Android or Web app. None of these are correct. So is 'Web' the best way to track my app usage? Or is Google Analytics not the right approach?

joeformd
  • 133
  • 10

3 Answers3

1

Google analytics really isnt designed for something like this. You have only two options web app where everything is page based. http://example.com/hello.php vs using a mobile app where everything is screen based. Home, about, help.

I have done this before with several console applications, a custom SSIS task (dll) and an arduino project. I chose mobile application mainly because i thought it was closer. I know of someone who did the same with an actions on google project.

In the end what you use will be up to you. Just consider what it is you want to track exactly and lay it out before you start.

If you choose mobile make sure you send Screen views and not page views. The Google analytics website is split you cant mix and match the hit type.

Workaround for createing moble account without firebase.

  1. create a new web property on Google analytics type Web
  2. create a new view under that web property type mobile.
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • thanks very much! When you choose mobile application, it then seems like, in Firebase, I have to select iOS, Android or Web app to proceed, than then asks me about those apps, which I don't have. How did you proceed here? – joeformd Feb 01 '18 at 13:30
  • just put bogus data in that. Go back to google Analytics create a new view and you can bypass the firebase crap. (its a workaround) – Linda Lawton - DaImTo Feb 01 '18 at 13:32
  • sorry for more questions - if I do that, I don't get a Tracking Id - it expects the Firebase SDK to manage all the tracking. Did you use the Firebase SDK, or somehow use the Measurement Protocol to send data from your app? – joeformd Feb 01 '18 at 13:43
  • I dont use the sdk i sent it all directly via the measurement protocol myself. Made my own dll for it. https://www.daimto.com/particle-google-analytics-webhook-introduction/ – Linda Lawton - DaImTo Feb 01 '18 at 13:48
  • hmm, maybe the UI has changed since you did it. In your post you say to copy the Tracking ID, however when I select 'Mobile app' I dont get a tracking ID, just a link to Firebase – joeformd Feb 01 '18 at 13:57
  • You need to go though the firebase create. Then go back to Google analytics and create a new property on your web property the new one you create will be without the firebase link. https://support.google.com/analytics/answer/2587086?hl=en Its a workaround i have complained to Google that they force you to create firebase when you dont want one. – Linda Lawton - DaImTo Feb 01 '18 at 14:04
  • Updated question create a web property type web then a new view type moble. – Linda Lawton - DaImTo Feb 01 '18 at 14:15
1

Seems like the best approach is Google Measurement Protocol. There's a Node library for it.

Really Google Analytics is completely designed around web apps and more recently mobile apps, it has concepts like "page views" which don't make sense for CLIs, and Firebase Analytics is only for Android and iOS.

You might be able to shoehorn he CLI use case for some purposes. Alternatively, you could consider using a cloud database like Firebase real-time DB to capture your own events.

mahemoff
  • 44,526
  • 36
  • 160
  • 222
0

We made Console Cat for this exact purpose! It's built from the ground up to track telemetry / analytics for CLIs including things like flags, command duration, version, etc.

  • 1
    Your answer could be improved by providing an example of the solution and how it helps the OP. – Tyler2P Jul 23 '22 at 10:03