Are variables passed in a URL tracked by Google Analytics - google-analytics

From what I understand, the data passed in POSTs from a form on a site is not tracked by Google Analytics. What about any variables that get passed in the URL, as in ?value=bla
Does value=bla get stored by GA?
If so, is there a way to not track variable info from the URL?
I am aware of the anonymizeIp for IPs.

GA profile settings have a text field where you can enter query parameters that should be ignored. You can also set up an advanced filter to summarily excludes all query parameters (simply google "exclude query parameters google analytics", there a lot of tutorials on how th do this).

Related

Send custom data to google analytics from server side

I want to send these information title, target amount, category, account name to GA for every user who creates a page in our website. And if anyone make transaction on that page I want to generate a revenue of 5% based on the transaction amount for every transaction. I've no clue how to do that.
So far what I've achieved is I set up the service account by following this link and create a custom dimension. Playing with the code snippet I can update the name of the dimension and other things but not sure how to send an object value with all the fields that I need in this custom dimension. My question is if I call this again will it update and replace the old value with the new value? I don't want that. Every time I want to insert a new value in the old value. Shall I need another dimension and what if I want to relate this custom dimension data to ecommerce later on. How can I do that?
try:
analytics.management().customDimensions().update(
accountId='123456',
webPropertyId='UA-123456-1',
customDimensionId='ga:dimension2',
body={
'name': 'Campaign Group',
'scope': 'SESSION',
'active': True
}
).execute()
Can someone please suggest me what should I do here.
you use the measurement protocol to send data to google analytics. The google analytics management api is only for managing your google analytics account.
POST /collect HTTP/1.1
Host: www.google-analytics.com
payload_data
This article should help you achieve what you want.
Basically the custom dimensions in your url should be like cd1, cd2 so on...
https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters?hl=en#customs
Here is a code sample that might help
https://www.simoahava.com/analytics/13-useful-custom-dimensions-for-google-analytics/#23-payload-length

Issue with integrating GTM Lookup Tables for multi-environment setup

I have been working on integrating GTM and GA to my website, using Environment Variables to setup GA Property Views for different setups.
I found similar solutions in various blogs, i.e., by setting up Lookup Tables or RegEx Table, with lookups for GA-Tracking-ID.
ISSUE
Lookup Tables adds a prefix vtp_ to the keys present in default GA-settings obj, as shown below:
Due to this, GA doesn't work.
If I use the GA Settings Variable directly, Everything works fine.
This happens on current Dashboard Setups for GTM and GA.
You cannot use a Google Analytics Settings variable as the output of a Lookup Table variable for a simple reason:
The "Google Analytics Settings" field in a tag is the only place where you can use a Google Analytics Settings variable, and it is the only type of variable you can use there.
In other words, if you create a Lookup Table variable that returns Google Analytics Settings variables, there's no place to add that variable to, since the only valid place would be the Google Analytics Settings field which, as noted above, doesn't accept Lookup Table variables.
Trying to add the Lookup Table into the "Tracking ID" field, for example, is a mistake, since the table returns a Google Analytics Settings object rather than a valid tracking ID.
i had the same issue, and i was mapping the lookup values to variables of type google analytics settings:
i changed them to strings then it started working:
Here's how I did it successfully with Dev and Live environments setup.
Enable Environment Name in Built-In Variables
Create a Lookup Table variable in User-Defined Variables as GA Tracking ID - ENV
For the Lookup Table row, change it accordingly. In my case, my environments are only Dev and Live so I put it there.
Create a Google Analytics Settings variable in User-Defined Variables
For the Track ID, select the GA Tracking ID - ENV - that's all the variable config for this to work in minimum.
Then Create a Tag for the Google Analytics
Make sure to select the Google Analytics Settings created.

How to extract the specific AdWord keyword that a client clicked on?

I'm using AdWords to help generate form submissions, and a form submission is my heuristic for a conversion.
I want to fetch the specific AdWords keyword that generated a conversion and submit it along with the form so that I can track which keyword are generating which submissions. Is this possible?
I don't see an cookie that relates to a Google Ad click, and the automatically appended gclid only contains a timestamp when decoded.
If you are using autotagging in Adwords then you will not get the keyword in realtime to send it along with the form.
You would either need to use manual tagging, and extract the value from the utm_term parameter, or configure valuetrack parameters to have the keyword/matchtype in your destinantion url.
In both cases you'd need to store the value from the query parameter (e.g. in a cookie), read it in the page with the form and append a hidden form field to your form that is set to the proper value.

GA Query parameters gone when using PageType?

On a page /user/survey I'm triggering a PageView event with PageType UserSurvey.
In GA I see this page views as follows: /user/survey+UserSurvey
However, users land on this page with different query parameters depending on the campaign they were interested in. For example:
/user/survey/?email_campaign=1
/user/survey/?offline_campaign=1
etc.
I want to see only users that came with email_campaign query parameter. How do I do that?
I can't find these query parameters anywhere in GA even when trying to segment the audience by page URL. Are query parameters gone and all page views will be grouped together when pages with different query parameters are using the same PageType? I can't believe some of the URL data could be gone this way.
I would suggest that you use UTM parameters to segment the audience.
For example:
/user/survey/?utm_medium=email&utm_campaign=campaign1
/user/survey/?utm_medium=offline&cammpaign1

Using Google Analytics how can I track different audience segments viewing the same page?

I'm looking for some general advice. The site I'm currently working on is full of duplicate content that's about to be deduplicated. But it was built that way to track different audiences visiting the pages by reporting on the URL hits.
Current Links
www.MySite.com/homeowner/painting
www.MySite.com/professional/painting
www.MySite.com/designer/painting
My concern is that at the end of the day, the person managing the analytics wants to be able to look at their report and say "We had X number of professionals visit the site." Simply deduping will elimate that.
I'm thinking Google Analytics might have a way to pass audience/tags in via the URL like this:
Example Links with Tracking
www.MySite.com/painting?tag=homeowner
www.MySite.com/painting?tag=professional
www.MySite.com/painting?tag=designer
Is this possible with Google Analytics? Does anyone have an example website using this?
I've looked into Custom Dimensions and Metrics but they seem to be overkill https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets
Custom Dimensions are not overkill, it's a reasonable idea for you to use them (because segmentation is what they are for, really).
Using a url tag has a couple of disadvantages. For one The tagged pages will appear as three distinct rows in your reports - you will be unable to get an aggregated number for www.MySite.com/painting, instead you will have three Urls (or as many as you have parameters).
Secondly, homeowner etc. are attributes that belong to a session, or even a user (if the role cannot change from visit to visit). However if you track them via url parameters they have only a hit level scope, i.e. they are recorded as a property of the viewed page, not the viewing visitor. If you record this as a session scoped variabe you need to set it only at the first pageview, and the value will be applied to all subsequent pageviews for that session.
So an easy way (example assumes you are using php) might be to use
if(isset($_GET['tag']) {
ga('send', 'pageview', {
'dimension1': "<?php echo filter_input(INPUT_GET, 'tag', FILTER_SANITIZE_ENCODED); ?>"
});
} else {
ga('send', 'pageview');
}
in your tracking code after you have created a session scoped custom dimension in your property settings ("dimension1" referring to the first custom dimension in your account, the numeric index changes for each dimension. The dimension name is only used in the reports, not the tracking code). You need to be careful not to send an empty value when the query string is not present - a session scoped custom dimension only records the last value from a session, if you send empty values you overwrite the value you recorded at the first pageview.
Alternatively you can do this without changing the tracking code at all - create a custom advanced filter to capture the value from the query string, a second to copy the value to your custom dimension and a third to remove the query string from the url. However while that's a neat trick using code is much easier.

Resources