Google analytics push custom channel grouping - google-analytics

Is it possible to push custom channel group into Google analytics in a similar way as events? For events I use this code:
_gaq.push(['_trackEvent', 'Popup - displayed', 'Popup displayed - Popup Id 5', 'This is popup title']);
Now I want to push new custom channel group Popup displayed each time user get served popup so I can compare results with Organic search without popup, Direct traffic without popup with organic search with popup.
I would like to accomplish something like this:
Tnx!

With the current Google Analytics version you could use a set call with your tracker object to overwrite campaign data and then create a custom channel definition that matches your custom data:
trackers = ga.getAll();
tracker = trackers[0];
tracker.set('campaignMedium', 'withPopup');
No idea how you would do this with your version of Analytics which is deprecated. Also this may have side effects (like loosing the original campaign data).
However you may simply create two segments, one for users who have seen the event and those who have not. Since you can select multiple segments this allows for a comparison without changing anything in the code.

Related

Google Tag Manager set field value to one of two variables

We are using Google Tag Manager. It is sending a custom dimension to Google Analytics with a value of {{fc-isSubscribedSession}} variable
The fc-isSubscribedSession variable is a DOM variable that is taken from the data-is-subscribed-session attribute on the page body.
We are migrating our platform. The old user interface makes use of the tag and the data-is-subscribed-session attribute. The new user interface is more like SPA so we are using the data layer to push the data to GTM like
window.dataLayer.push({
'newInterfaceIsSubscribedSession': current_user.is_subscribed?
});
(above is a fragment that is close enough to the real call)
Now the problem is that we must fill the dimension from fc-isSubscribedSession or from newInterfaceIsSubscribedSession.
Do you know if there is a way to fill a dimension from one of two values?
Something like
{{fc-isSusbscribedSession}} or {{newInterfaceIsSubscribedSession}}

Why can't I create a Google Analytics property view?

I'm trying to use Google Analytics as a data stream for Google Data Studio but it requires me to have a property view. There is no option for me to create a view in my property in the administration page:
There is no column named Views:
Is there something I need to do to be able to create new views?
OBS.: My Google Analytics account was imported directly from Firebase.
Google Analytics is changing and it is a bit confusing. I will try to clarify it for you. As far as I have gone, evolution has been:
1.- "App + web property" (Beta phase)
2.- "Universal Analytics" (*) (until 14-Oct-2020): It is identified because the account number is preceded by "UA-" eg. UA-123456789 (Attention, sometimes it is not very obvious and you have to create a new user to see the UA prefix). This option is only suitable for the monitoring and analysis of Web pages and has the option of analysis using "Views" enabled. If you don't have it, you should:
2.a.- Create a new "Property"
2.b.- "Show advanced options"
2.c.- Activate "Create an Analytics Property"
2.d.- Create only one "Universal Analytics" Property
3.- "Google Analytics 4": It is identified because the account number is preceded by "GA4-" eg. GA4-123456789. In this case, the analysis is not done through "View" but through "Data Stream" (** incorporating a series of improvements) although Google offers the possibility of creating two "Properties" one in UA format with Views and another in GA4 format with Data Stream
In all cases, you must place the corresponding gtag provided by Google Analytics within the tag of the page you want to analyze.
Sources
(*) https://support.google.com/analytics/answer/10089681?hl=es&utm_id=ad
(**) https://support.google.com/analytics/answer/9216061?hl=es&utm_id=ad
https://support.google.com/analytics/answer/9367631
https://support.google.com/analytics/answer/9539598?hl=en#:~:text=If%20you%20set%20up%20a,with%20%22UA%2D%22).
This is a good answer to that question. I had the same problem. In case the URL doesn't load, essentially,...
"If you set up a Google Analytics 4 property with a Web data stream, you have a Measurement ID (which begins with "G-").
If you set up a Universal Analytics ("Web") property (Universal Analytics properties have views instead of data streams), you have a Tracking ID (which begins with "UA-")."
You cannot have the property be a Google Analytics 4 property with a web data stream and have a view page as well. If you want the View page, then when you create the property, make sure its Universal Analytics.
Hope this helps, I'm new to this game.

Google analytics user explorer get user report

How do I get user report from user explorer, using GA API. Didn't manage to find any information about it here https://developers.google.com/analytics/. For instance in user explorer (audiences section) you can see a list of records having ids like 11111111111.2222222222 and I want to get information about user activity on the website for record with id 11111111111.2222222222 using GA API
While the latest GA release notes says the client ids have been "surfaced" (i.e. made visible) it is (at least currently) not available as a dimension via the API. So if you want to use it you'd have to add the client id as a custom dimension to your reports yourself. Off the top of my hat this should look something like this:
ga(function() {
var trackers = ga.getAll();
trackers.forEach(function(tracker) {
tracker.set('dimension1',tracker.get('clientId'));
});
});
Put before the pageview this would write the client id to your custom dimension with the index 1 (which you need to create in advance via the interface in properties->custom definitions). Should also work with multiple trackers on the same page.
This will of course not help you with data that's already been collected.

How do I pass a parameter from my site into google analytics?

Let's say I have a site and the user comes into it with a parameter:
http://example.com&url=blahblahblah
How do I go about passing along the url value from the parameter into Google Analytics?
1) User comes to the page with a url in the params
2) User clicks a download link with a ga tracking code attached to it which was generated from ga account like this:
http://example.com/download/param1=dkljdf&_ga=1.149898996.39207121.1424368466
You have to create a custom Dimension and a metric for that.
About custom Dimensions and metrics:
https://developers.google.com/analytics/devguides/platform/customdimsmets
After you have created a Dimension, you can add metrics to it by view, in example.
Follow the steps here for Universal Analytics:
https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets
Note that due to not have 10 point of reputation, I wrote the a "_" in http like "ht_tp"
BUT:
I think what you want to know is the number os visitors that clicks a download link in your site that comes from, lets say "blahblahblah" as web origin or other methods.
For that, you have the param utm_source that you can receive directly in the url.
So instead of ht_tp://example.com&url=origin you should receive ht_tp://example.com&utm_source=origin
In this way, you have no care about it. Analytics is going to take care for you so you can get a report of clicks by source.
Or, just use the referer in case all the incoming visitors are from webs:
ga('set', 'referrer', 'ht_tp://example.com');
And a final option, to use Events:
_gaq.push(['_trackEvent', 'ReferencedVisitors', jsVarWhereYouHaveTheOrigin]);

How to Track Store Locator Search terms in Google Universal Analytics

I am in the process of setting up enhanced Ecommerce for GA and have had a few requests of additional of what else the client would like to see in their reports. Once of which is
"Where can i see a report if the locations that a use types in when they use the store locator"
There is already an internal search functionality thats been set up and is tracking the search terms people are typing when looking for products, but i'm not sure if i would need to set this up as a second search terms report or if it's something different?
The URL of the page is different to the internal search results and is www.domain.com/store-locator#wales|GB|0|0|0
Any insight into this would be really helpful.
Thanks,
Roxi
As to me knowledge, you are not able to use bookmarks (#something) in GA for internal site search setup. Only GET and POST parameters are allowed. In your situation I think the best solution is to use GA events to send the data about used location each time the user is using this functionality. You need to include addition ga() function call to track those events. Info about how to set it up you could find here: event tracking. After setting things up, you will see all the info about number and type of called events in Behavior -> Events reports section in GA.
Example code:
<button onlick="var hash_location=window.location.hash;ga('send','event','Locator',has_location)">Click me</button>
With such function new event will be send to GA with Event Category=Locator and Event Action=hash in the url. You have some complicated hash, so most probably you need to extract first some info from this using regular expression. Example to get first item from |-separated list in the hash:
var pattern = new RegExp('[^#|]+');
var hash_location = pattern.exec(window.location.hash)[0];

Resources