Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Google Analytics from backend

Tags:

There is some custom google analytics events I've specified for my application. Trigering these events is sometimes not very easy.

For example: User is redirected to home page after purchase and I have to forward some data that this home page is displayed after purchase to push something to _gaq based on that.

Is there any way to trigger google analytics from backend e.g. in a controller without taking care if the action is ajax request or plain request and response has redirect or Ok status?

like image 868
Bogdan Gusiev Avatar asked Aug 03 '12 12:08

Bogdan Gusiev


People also ask

Is there any API for Google Analytics?

Introduction. The Google Analytics Reporting API v4 provides programmatic methods to access report data in Google Analytics (Universal Analytics properties only). With the Google Analytics Reporting API, you can: Build custom dashboards to display Google Analytics data.

Can Google Analytics work retroactively?

The answer is simple: No, Google Analytics filters do not apply retroactively. They only apply to data gathered after the filter is applied.


1 Answers

To trigger Google Analytics from the backend you should use: Measurement Protocol.

That is part of the Analytics Collection:

Web Tracking (ga.js) Measure user interaction with websites or web applications.

Android Measure user interaction with Android applications.

iOS Measure user interaction with iOS applications.

Measurement Protocol Measure user interaction in any environment with this low-level protocol.

At the moment it is available as dev preview. To signing up simply request access to the beta.

like image 139
Filippo Vitale Avatar answered Sep 20 '22 18:09

Filippo Vitale