joeformd
joeformd

Reputation: 143

Set up Google Analytics to track a command line Node app

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?

Upvotes: 4

Views: 1998

Answers (3)

Matt Evenson
Matt Evenson

Reputation: 9

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.

Upvotes: 0

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116918

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.

Upvotes: 1

mahemoff
mahemoff

Reputation: 46389

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.

Upvotes: 1

Related Questions