Google Analytics: Using custom variables to track growing values - google-analytics

I believe custom variables in Google Analytics can only be used to track the distribution of different values for that variable over time.
Suppose I have a forum and want to track the total number of posts made in that forum. Could I track them over time with Google Analytics, too? And how?

Custom Variables are a user-based dimension. So, traditionally, instead of measuring forum posts, they'd instead identify users who post on forums. That doesn't seem like what you're trying to measure.
Instead, you should consider looking at Event Tracking. Specifically, they allow for the tracking of 4 separate data points (per hit): 3 strings and a integer value.
So, you could use this to track when posts happen, or when comments happen on those posts, and then aggregate the values by whatever dimension you like using the API. You'd just need to bind the event to occur at the times you intend, with the data you want to track.
So, an example event call for you, tied to whenever someone posts a comment on a forum topic:
_gaq.push(['_trackEvent', 'Form Posts', 'Comment', topic_name, 1]);
You could then use the API to query particular views to tabulate whatever aspect of the event you want to aggregate. You can simulate those calls with the Google Analytics API Query Explorer. In this example, you could get number of Comments per day using Dimension set to ga:date, Metric set to ga:totalEvents, and then set the filter field to ga:eventAction==Comment

Related

how many values can a custom dimension take in google analytics?

To anonymously analyze users flow and engagement I want to use the ClientID, as identifier of each user, as a value of a custom dimension. I have two questions regarding this idea:
How many values can be associated to a custom dimension? This will determine the feasibility of this approach or not.
Is there any other approach to track individually, yet anonymously, users activity?
I'm not aware of a limit though for custom dimension length. But storing userId, sessionId customerId and timestamps for all hits in custom dimensions is not all that unusual these days. Here is a link to a post by Simo Ahava's post Improve Data Collection With Four Custom Dimensions on how to set it all up in google tag manager.
For hit based custom dimension you can store as many values as there are hits. The problem is not storage, the problem is that the interface will not show more than 50 000 rows with distinct values (any additional value will go into a row labeled "other"). Also some of the reports (namely demographics) will not work with very small segments.
I cannot think of any other way to track users individually (and if you are interested in opinions, I blogged about how I do not understand why people want to do this). The interface is not very well suited for this kind of "atomic" information, so I think the approach is more useful for API integrations that can properly visualize information on a per user basis.

Google Analytics unique events is incorrect

We have a Google Analytics account set up to track downloads on certain files. When you create a report with, for example, Event Label (user) as the primary field, and Event Action (file name) as the secondary field, GA will say that the number of unique events is 168. When you add up the numbers in the unique events column, however, they add up to 322. Exporting the table as a CSV file and viewing it in Excel will also give you 322.
I should also add that there are 270 rows in the table, so for there to be 168 unique events, that would mean some user/file combinations would have 0 unique events, which doesn't make any sense.
Can anybody shed some light on why this is happening?
There is a lot of confusion with Unique Events metric. Instead of counting a number of times an event with unique combination of category/action/label happened, GA was counting unique combination of every dimension included in the report!
Finally that metric is deprecated now and renamed to Unique Events (legacy).
Instead we get a real Unique Events (new) metric which behave like expected.
More explanation in my blog post
http://www.internetrix.com.au/blog/google-analytics-unique-events-are-dead-long-live-unique-events/
In all Google Analytics custom reports, the Unique Events field actually reports the number of Visits (or sometimes a slightly higher number).
Built-in Google Analytics reports will show you the correct number of Unique Events.
It's a bug, plain and simple. I reported it to Google back in August, but it's still broken.
The number in the Google Analytics standard reports can be explained...but as Aaron pointed out, it sure looks broken. I wrote an article explaining it all:
http://www.analyticsedge.com/2014/09/misunderstood-metrics-unique-events/

Google Analytics Event Tracking reporting inflated event values

We recently released two typefaces on our website for free (albeit suggesting an optional donation). I decided we should track downloads through Google Analytics using the event feature, so we ended up adding the corresponding JS snippet to the download form (on submit), something akin to this:
_gaq.push(['_trackEvent', 'Typeface', 'Download', 'Typeface #1', parseInt($('input[name=amount]').val(), 10) || 0]);
I also decided we might as well use GA to keep track of donations, so as you might have noticed the optional donation amount is being sent as the event value argument. There's already a browser-side numeric-only verification, and it will set it to 0 in case it's empty (NaN), so we're completely sure it's always an integer (required type for the argument).
I configured two different goals (one for each typeface) in our GA profile, using the two different events as their respective conditions, as recommended by every howto I've been reading about this subject.
However, some of the reported data appears to be somewhat inflated. According to GA there's been, as of now, 455 unique events out of 550 total events, which seems to be okay, but apparently it's worth a value of over a million dollars. And, believe me on this, we have not received such a huge amount, at least just yet.
According to GA: Event Value is the total value of an event or set of events. It is calculated by multiplying the per-event value by the number of times the event occurred.
I assumed I could set individual values to different instances of the same event, even GA documentation leads me to believe so with their examples, so I don't really understand why it's being reported as such an inflated total value.
Is there something wrong with my assumption? Is this the correct approach to what I'm trying to accomplish? should I just forget about keeping track of donations using this method and resort to using the e-commerce feature instead as I've also been reading about?
I'm not checking for any verification of a donation successfully completing, so I'm left with an estimate and I'm okay with that. Maybe someone jokingly wrote off some exaggerated amount then never completed the donation process?
Your assumption is right : you could set individual values to each event and "the report adds the total values based on each event count" (as explain in doc).
The main problem with your approach is the one you mentioned : you count the donation at form validation, before its confirmation and even before you told your visitor that the donation must be made via PayPal. So yes : some people probably wrote off some exaggerated amount or simply not complete the donation process.
I recommend you to use e-commerce tracking after the PayPal payment to avoid unconfirmed donation tracking and the lack of deduplication using goals values to monitor amounts.

Google Analytics update a counter based on entries in databse

Is it possible, and if so, how to make a "custom" counter entry in GA, which basically is a count based on database entries.
Quite hard to say without knowing your specific use case, but Google Analytics supports events. You can send custom events to Analytics on every page load. You can then think of a structure with different categories and labels where you can filter these.
If you just want to show the change of the number of entries in a table, you could also think of using a monitoring software like munin. Think about whether your data makes sense together with your other Analytics data or if you just want to show the changes over time together with your other server health parameters.

Doing cohort analytics on Google Analytics

Suppose I have 65 people that register on January 1, 2012.
I want to find out how many of those 65 people returned to the site that same week. (More generally, if n people signup on date A, I want to be able to find out how many of those n people return in a given date range.)
Is there a way to do this using Google Analytics? If so, how? I am currently getting the user's username for each page hit.
If you only need to track people who sign in then you don't need to get very fancy. You can copy the relevant user attributes, such as sign up date, from your DB to GA using events or session level custom variables.
But if you want to track everyone, including those who don't sign up, then you'll need to use visitor level custom variables (GA cookies).
I explain how to set this up in detail in this post so I'll just highlight the key points here:
First, decide how to layout the data in Google Analytic's custom variables based on your requirements. For example, are you storing retention dates for daily, weekly or monthly tracking? Do you also want to track cohort goals? Partition this data into the available custom variable slots.
Write the cohort data to these custom variables when visitors arrive or achieve goals using Google Analytic's _setCustomVar function. Setting the fourth parameter of that function to 1 indicates you want to do visitor-level (cookie) tracking.
For each cohort you wish to analyze, create an advanced segment in Google Analytics. Using a regex expression in the condition will give you the flexibility to segment for interesting cohorts. ex: "All users whose first visit was the week before Christmas".
Analyze the results with reports by specifying a date range and the corresponding cohort-sliced advanced segments. Another option is to extract the data using the Google Analytics Data Feed Query Explorer or their API.
Once you've put in the work your new visitors will be stamped by their first visit date and nicely fall into each daily or weekly retention bucket. This is what it might look like if you were tracking weekly retention, for example:
This is not a full solution, but here are some points on how I would approach this problem with the help of Google Analytics:
You have to make sure that you somehow store the registration date of each user, either in your database or in a cookie. Then have a look at Google Analytics Event Tracking. You could for example set up a new category based on the registration date. On every page load in your page, you then have to set up this event tracking call, for example like:
_trackEvent("returns", "2012-01-01", "UserId:123123123")
This way you will receive all page views for users that registered on that particular date. To add a date range in this, you have to make sure that these events only get fired for the number of dates after the signup (e.g. 7 days).
After your date range, you will be able to see how many page views and how many users returned - you even know which users came back.

Resources