Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Unique Custom Metric in Google Analytics

Consider a web application that gives out services to different schools, that is, each log in credentials consist of three parts: school code, username and password. I've been asked to setup Google Analytics for this website and create a couple of reports for it.

There's one particular report which I still couldn't figure out how to implement: The number of active schools per date. An active school is one which some student of it has used the website. Here's my approach so far:

I decided to incorporate events and send them regardless of page load (it's a Single Page Application anyway). I would then send an event for each log in including the school code. To keep the question short, no matter what I did I could not find a way to count the correct number of active schools. I've tested with Unique Events, Custom Dimensions and Custom Metrics. In case of Unique Events, sessions disturb the results and in case of Custom Metrics, there's no such thing as "Unique Custom Metric"!

The worst part is that each new solution I would want to test takes me a day! And it's driving me crazy (patience is not my specialty).

[UPDATE]

To make the question easier to understand, consider having a web-shop that sells different kinds of products. How can you create a report in GA that shows how many unique products' pages have been seen for a period of time? i. e., if product X's page has been seen today, it will increment today's bar by one in the report, regardless of how many times it's been seen.

like image 985
Mehran Avatar asked May 03 '15 03:05

Mehran


People also ask

How many custom metrics Google Analytics?

There are 20 indices available for different custom dimensions and 20 indices for custom metrics in each property. 360 accounts have 200 indices available for custom dimensions and 200 for custom metrics. Custom dimensions cannot be deleted, but you can disable them.

What scope applies to custom metrics in Google Analytics?

What scope applies to custom metrics? Every custom metric that you create in GA can have each of the following two scopes: Hit – the value of the custom metric is only applied to the hit with which the value was sent. Google Analytics will calculate and send the value for each hit.


1 Answers

your task in a first look is pretty simple, but it fact - it's not. What you can try to do: each time, when user logged in, send event with parameters:

  • Category: unique school identifier
  • Action: whatever you want (for example, hashed login or user ID)
  • Label: empty.

After simulation data looks like:enter image description here As event labels are unique for each school, then count of active schools per day - is count of rows at table with events(marked at image).

What's bad in this approach:

  1. You can only choose one separate day to analyse, how many schools were active. So you can't choose range like May 1 - May 5 and get report with count of active schools per day. You should manually choose five 1-day periods(May 1- May 1, May 2 - May 2 and so on) and manually grab count of rows in events table for each day.
  2. Unfortunately, you can't access to metric "Count of rows" in Google Analytics interface and show it at custom report. This may available at Google Analytics API(require a lot of programming, not sure that it's what do you need).
like image 122
Ruslan Konygin Avatar answered Nov 26 '22 05:11

Ruslan Konygin