Analytics Solution for new SAAS application - google-analytics

I have a new tech startup creating interactive videos and i need to implement an analytics layer. This layer needs to track time on video, if a user clicks on interactions, etc etc. Can someone suggest if there is a 3rd party analytics solution I could use to implement this? I am not sure if I can use google analytics to capture the data and then display a custom dashboard on the data it collects? Another alternative is should i try to roll my own solution (i have never done this).
Any advice on a possible solution / route would be awesome.
Thanks

You can use Google Analytics for this, it support custom defined events and you can trigger it whenever event you want to track happens.
https://developers.google.com/analytics/devguides/collection/analyticsjs/events
ga('send', {
hitType: 'event',
eventCategory: 'Videos',
eventAction: 'play',
eventLabel: 'Fall Campaign'
});
There are many other SAAS platforms, which you can check. Even some Front-End only libraries with defined API so you can create your own infrastructure.
https://matomo.org/
https://count.ly/web-analytics
https://mixpanel.com/

Related

What is gtag and why do I have to add that separately from google tag manager?

I find Google documentation around Google Tag Manager (GTM) terrible at helping me figure out which bits go where.
As I understand, GTM requires that you put a <script> snippet on your pages which is supposed to bring in other code snippets, as could be configured by a non-technical user.
I'm a technical user, though. Perhaps that's the problem! I also find it problematic that Google use the word "tag" to refer to either an HTML element tag, like <script>, or their own proprietary use of the word to mean calling a function ("triggering a tag") in another script, also unhelpfully referred to as a tag.
They also have "gtag" which is what - a helper? something that enables you to send general analytics events through the GTM API? The docs simply say:
The global site tag (gtag.js) is a JavaScript tagging framework and API that allows you to send event data to Google Analytics, Google Ads, and Google Marketing Platform.
... but we could already send analytics? What does this add?
For example, I wish to send an e-commerce Purchase event.
I've found that to do this I needed to add a new snippet of code with two <script> tags to the header on the site (thought GTM meant I didn't need to do this?) that sources gtag.js, then I'm able to call the following at the appropriate place in my javascript:
gtag('event', 'purchase', { value: 1.23, transaction_id: 'test' });
Or without it (although this does not seem to work):
ga('require', 'ec');
ga('ec:addProduct', {name: 'test product', price: 1.23})
ga('ec:setAction', 'purchase', { id: 'test_id_1', revenue: 1.23 })
So my question is: when would you use gtag() over ga(), and why can't GTM install gtag?
When would you use gtag() over ga()?
Use gtag if you want to send data to supported Google products other than Google Analytics. As you pointed out, "The global site tag (gtag.js) is a JavaScript tagging framework and API that allows you to send event data to Google Analytics, Google Ads, and Google Marketing Platform.", whereas ga only works for Google Analytics. But (see below), you might decide to never use gtag nor ga and always use GTM.
Why can't GTM install gtag?
It could (you could have a GTM tag inserting some gtag code) but it's beside the point as they are meant to be used as 2 different solutions:
gtag is a purely programmatic tracking tool for sending data and only works with 3 Google products (so far - Analytics, Ads, Marketing Platform - more maybe added in the future), it's made to provide basic out-of-the-box tracking with a simple copy/paste + small lines of code (if needed for customization).
GTM is a tag manager: it can work programmatically BUT requires a minimal configuration of the container via the GTM UI (a default container won't send data anywhere), and can send data to whatever products you want (just need to setup the corresponding tags in GTM), while having a bunch of other features
A few questions to help you choose:
Am I sending data to other tools than Google Analytics/Ads/Marketing platform?
Do I want to use some the extra features GTM offers (UI, version control, templates, debug, environments etc...)?
Is there some tracking that would be heavy to implement via pure custom JS (eg scroll tracking) which GTM can facilitate with its built-in listeners (eg scroll tracking)?
If YES to any of the above, then use GTM
I personally never use gtag, I always replace it with GTM because it's considerably more powerful than gtag.
What Google is doing is progressively replacing all their default snippets with gtag so they only have 1 unified API to maintain and it's an easy copy/paste for users (bear in mind most users aren't tech savy and just need to paste the snippets in into their CMS). Forcing people to use GTM would be too much of a friction as out-of-the-box GTM simply doesn't track anything and people would need to learn & configure GTM, too much work vs a simple copy/paste.
Note: The built-in events don't use category, label, and value. Take care to use the correct keys when sending these events.

Can Adobe analytics variable be passed to a Google analytics custom dimension?

Does anyone know if it's possible to capture the variables from an Adobe Analytics implementation and pass them to GTM so that they can be used as custom dimensions in Google Analytics?
I was wondering if there was some javascript that i could implement in GTM that would extract the neccessary props i want from the adobe data layer, but im not a developer so im not even sure if this is possible.
Thank you!
This looks to me like exactly the guide you are looking for:
http://blogs.perficient.com/adobe/2017/04/12/custom-adobe-analytics-tracking-using-google-tag-manager/
I don't have any personal experience with Adobe Analytics so I cannot help you further than that. However I can tell you what you are trying to achieve is most definitely possible.
This is definitely possible and not hard to pull off. There is even a google analytics tool than can be used for adobe dtm.
Just doing it manually through code, make sure that GA is already present on the page, and fire this code in a third party script after you AA variables are set.
ga('set', 'dimension1', value1);
ga('send', 'pageview');
You can set multiple dimensions at once:
ga('ehiglobal.set', {
'dimension2': value2,
'dimension3': value3,
'dimension4': value4
});
You can also pass specific page names on the hit:
ga('send', 'pageview', location.pathname);
You can also send an event hit if you already have page views set up:
ga('send', 'event', 'category', 'action', {
'dimension5': value5
});
**Note: You need to send the data through a page view or a hit. Just setting the data wont do anything, so make sure you actually have one of the send events

Correctly add dataLayer information (dataLayer vs ga('ec:...')

I want to implement Google dataLayer for a client, and after reading docs, articles, and trying out browser extensions, I am still a bit confused.
I saw 2 versions of it being used:
dataLayer.push('ecommerce': {
'detail': {/* data */},
'impressions': [{/* data */}]
});
and
ga('ec:addImpression', {'id':'%s', 'name':'%s', 'category':'%s', 'brand':'%s', 'position':%s, list: '%s'})
ga('send', 'pageview');
Is there a preferred version, or do both work ? Also, for the second option, do I need to use ga('send', 'event', '......') each time after using the ga('ec:something') function ?
First one is the dataLayer as used in Google Tag Manager.
The second is not a dataLayer at all, these are direct calls to the Google Analytics tracking code (which would need to be loaded for this to work).
So these are two different things, if you really intend to implement a dataLayer to use with a tag management solution you need the first solution.
And not to be unkind, but if you can't tell the difference you should start by reading Google's really extensive documentation. From your question it is not even clear what you intend to do, since dataLayer is not a Google product, it's just a variable that feeds into Google's tag management solution.

Google Analytics API For getting total clicks and impression on element

I am really new to Google Analytics and I had a requirement of tracking clicks and impressions. I followed following link
http://www.statstory.com/tracking-clicks-and-impressions-in-google-analytics/
and sucessfully implemented the same.
Now my requirement is to get the no.of clicks and no. of impressions
to my html page. I am googled for past quite hours but couldnot find
any luck with the same.
Any help would be highly appreciated.
You should really consider implementing Google Analytics Enhanced E-commerce functionality.
Google Analytics Enhanced E-commerce
In regards to answering your question of the API, you should query it asking for events. Namely category, action and label events and apply a filter to only return the data you wish to receive, such as 'Impressions' as a filter for 'Event Action'. That will return all impressions and if you instead change the filter to use 'Click', you'd get all clicks instead.
If you followed the above guide and made it into Universal, then you'd see the calls you set and it is set up in the following way:
_gaq.push(['_trackEvent', 'Banner', 'Click', 'BANNERNAME',1.00,true]);
This bit of code pushes (legacy version) Analytics data in the form of:
_gaq.push(['_trackEvent', 'Category', 'Action', 'Label',1.00,true]);
So, changing the different sections means you change how you define the data and how it will be visible in reports. Category defines the Event Category, Action defines the Event Action and Label defines the Event Label.
Take a look at the core development guide. Also, here you can see all the API calls available: Dimension & Metrics explorer for Google Analytics
I gather that you want to track impressions for banner advertising that is displayed by yourself (i.e. not through an adserver) in your website.
I agree with Mr Sponge that you should upgrade to Universal Analytics. if you want to implement enhanced e-commerce tracking (EEC) you probably want to read about Measuring internal Promotions, which is a feature specifically build for that kind of reporting.
If you just need the raw number of banner impressions and/or need a solution that's easier to implement (but less capable) you can increment a custom metric every time you banner shows up (this is basically a counter, you might want to use it together with a custom dimension that holds the banner name). Click tracking would still be done by events (with similar custom metrics and dimensions). From that data you can assemble a custom report and use a calculated metric for click through rates etc.
Not as good as EEC by a fair margin but much easier to do.

Ember.js and Google Analytics

I wanted to get a definitive answer on here for later reference now that we have a stable Ember RC. A combination of the top 2 search results for emberjs google analytics reveals that this is a good way to do track route changes:
App.ApplicationController = Ember.Controller.extend
routeChanged: ( ->
return unless window._gaq
Em.run.next ->
page = if window.location.hash.length > 0 then window.location.hash.substring(1) else window.location.pathname
_gaq.push(['_trackPage', page])
).observes('currentPath')
but then I also see results for using Event Tracking for single page web applications.
I haven't tested the code above yet, it takes a few hours to propagate changes to the GA dashboard. Update: This doesn't show up under the Content category on my Google Analytics dashboard. Neither under "Pages" or "Events".
If anyone has advice or if there's something I'm missing somewhere let me know. I can also PR a guide for the website based on the answers here.
Alex DiLiberto gave a really nice talk about a robust & scalable way of adding Google Analytics to an ember app in his EmberConf 2014 talk here.
- Slides
- GitHub
App.ApplicationRoute = Ember.Route.extend({
actions: {
didTransition: function() {
Ember.run.once(this, function() {
ga('send', 'pageview', this.router.get('url'));
});
}
}
});
The talk was aiming to be independent of which analytics library was used.
There is also now an official Ember Cookbook on implementing Google Analytics here.
I would use _trackPageview for things that have routable URLs and _trackEvent for things that don't.
In the Event Tracking link when they refer to "Embedded AJAX page elements". They're not meaning SPA's, but rather those cases when the URL stays the same, but some event that you wish to track happens within the page (in the case via AJAX).
There may be other cases where it makes sense to use _trackEvent, but for route transitions I'd use _trackPageview.
Using routeChanged() is not a good way to track dynamic segments such as /category/food /category/something since it's going to be fired only once. I wrote an article about this here: http://www.randomshouting.com/2013/05/04/Ember-and-Google-Analytics.html. I also consulted with the guys behind Ember and confirmed that this is indeed the proper way to track url changes for Google Analytics.
Most of these answers are outdated. You should be using a mixin and adding it to your Router to listen for the didTransition event and fire your pageview there. That way it's handled for all routes. There are several addons out there, including one I wrote called ember tracker which gives you pageviews and event tracking out-of-the-box.
You can see how I did it here. It's fairly straight forward.

Resources