Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js: Google Analytics in the server side

Can I submit Google Analytics event in Node.js/Express? Is there any SDK for that?

I'd like to do something similar to: Event Tracking

like image 359
Valeri Avatar asked Mar 07 '18 04:03

Valeri


People also ask

Is Google Analytics server-side or client side?

Analytics collection can take place on both the client and server side. Google Analytics provides easy to use APIs and SDKs to send data to Google Analytics. In addition to those, we have developed code that you can use in your App Engine applications to easily send server-side analytics to Google Analytics.

Is node js server-side technology?

Node. js is a server-side JavaScript run-time environment. It's open-source, including Google's V8 engine, libuv for cross-platform compatibility, and a core library. Notably, Node.

Why node js is used for server-side?

Node. js is a JavaScript framework for writing server-side applications. In its simplest form it allows you to trigger small JavaScript programs from the command line without any browser involved. For example, assuming node is installed if you write a JavaScript program in a file called hello.


1 Answers

You're probably looking for universal-analytics which allows you to send Events much like ga on the browser like so:

visitor.event("Event Category", "Event Action").send()

where visitor is instantiated like so:

var visitor = ua('UA-XXXX-XX') // Your Google Analytics ID
like image 120
nicholaswmin Avatar answered Nov 02 '22 02:11

nicholaswmin