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
Related
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/
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.
I've got an email campaign that Im trying to track with Google Analytics, but for some reason the source, campaign etc are not being tracked.
The URL I'm using is:
https://makemeacocktail.com/list/14911/wimbledon-cocktails/?utm_source=mailinglist&utm_campaign=weeklynewsletter&utm_term=wimbledon
I've obviously got some htaccess rules kicking in that change the php _GET variables, but that shouldn't really matter here (I dont think).
My GA tracking code is:
const dimensions = {
TRACKING_VERSION: 'dimension1',
CLIENT_ID: 'dimension2',
};
const TRACKING_VERSION = '1';
ga('create', 'UA-22275118-1', 'auto');
ga('set', 'transport', 'beacon');
ga('set', dimensions.TRACKING_VERSION, TRACKING_VERSION);
ga('send', 'pageview');
ga((tracker) => {
var clientId = tracker.get('clientId');
tracker.set(dimensions.CLIENT_ID, clientId);
});
and passing the GA script through using:
<script async src="https://www.google-analytics.com/analytics.js"></script>
(This can all be seen in the source). Am I doing something fundamentally wrong?
Thanks in advance
Here are a few thoughts to troubleshoot this:
Install the Google Analytics Debugger in Chrome and verify your pageview is triggering when the campaign URL is there. You'll be able to see individual dimensions and metrics too (so you can check you custom dimensions too).
It seems like you're implying that the pageviews are working, but I wanted to include this just for due diligence.
Looks like you're relying on ES6 and the beacon to send data. That should be fine, but if your users are on older browsers that may prevent the data from coming through.
UTM campaigns require a utm_campaign, utm_source, and utm_medium to be valid. This does not prevent them from sending, but I'd recommend updating your campaign URLs if possible (you're missing utm_medium).
Are you using a filtered view? If so, your own traffic won't appear in the reports.
Are you using the Real Time reports? If not, you'll need to wait a few hours before the data becomes available in the Google Analytics standard reports.
Hopefully one of those steps gets you pointed in the right direction. Best of luck!
Edit: Viewing the source of that link you provided, I don't see your Google Analytics snippet in there. Maybe you're working on it now, but try viewing the page in an incognito window and check the source (maybe your script is tied to an admin or dev user?).
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.
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.