I currently have a bunch of traffic going to my website with a query string like so: www.mywebsite.com/?source=facebook
I've installed GTM on my website and also from GTM fire a Google Analytics Page View etc. What i'm wondering is through GTM, is there a way to grab the source (facebook) from the url and set utm_source=facebook when firing the pageview tag.
Or is my only option to change all the links going to my site to be:
www.mywebsite.com/?utm_source=facebook instead?
Thank you everyone for your expert advice. Really Appreciate it.
You can fetch the parameters via an url type variable, and then use the "set fields" option in your GA tag to populate the "campaignSource" and "campaignMedium" fields. If the parameters are not present the url query variables default to "undefined", and undefined fields are not sent, so you do not need to check if values are present.
Related
We have a search box on our website that searches a product we subscribe to. It's hosted on the third party's server, not on our domain.
Since it's just embedded on our site, I can't use Google Analtyics' built in configuration for tracking site search.
Is there another way I can track the terms used to search in the form, using either Google Analytics/Tag Manager?
yes, you can use GTM if the search query is entered on your site. Let's say, using a trigger on the search CTA click, you can then use a custom JS variable where you get the value of the search field using JS, use that variable in a GA event tag and there you have your value logged in GA.
We have a site where users login to access technical information. Before accessing the information, they also have to enter a set of filter options. Different filter options result in different information displayed on different pages but the url is the same.
For example, a user will get the following URL when accessing a specific document, regardless of what filter options set:
www.site.com/fr/category/document/
Depending on the filter options, different sections of the document will be visible.
Currently, no information in GA tells us what filters were used when visiting the page. We do not want to add filter parameters to the URL. At least not for the visitor, but maybe add it in the tracking somehow?
What would be the optimal/correct way to track that kind of information?
Best solution may depends how your site works etc. But how about using custom dimensions assigned to "hit" (pageview) scope? Maybe they will help in your case? Documentation: https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets (code in documentation depends how your GA is implemented of course). Thanks to them you can send with pageviews hit additional (custom) information (e.g which filters were used).
Other way could be just sending google analytics event (https://developers.google.com/analytics/devguides/collection/analyticsjs/events) with information which filters were used before pageview hit. Then just in Google Analytics panel you can create custom segment with sequence where 2 events occurred:
Click (or use filters) - event
See specific URL - pageview
Or of course you can implement both solutions (custom dimensions for pageview and events).
I have a website build with one of the most amazing frameworks on the world. Unfortunately it has one downside. It does not allow to use query parameters, for example: www.url.com/page/1 is ok but www.url.com/?page=1 is not ok. When you put this URL it uses browser history so there is no query parameters left in URL.
I have a campaign in Google Adwords that directs users to this website. Auto tagging is on. I've noticed there are 10k clicks to my website, but Analytics does not report such number for Adwords source.
I discovered that Adwords auto tagging is adding gclid parameter to the destination URL. Than, Analytics knows everything about the campaign because Analytics and Adwords are linked together and i should have pretty analytics data on campaigns and their conversions.
But i don't have it. Since my one of greatest website frameworks removes with its JS code the gclid parameter, Analytics does not notice the gclid and not save the source of the user.
To check if it is really my great website framework issue, i've added utm(umt) parameters to my website and checked source in real time in Analytics. It was not reported as source i provided in parameters but a direct visit.
I would like to be able to analize Adwords performance in Analytics. I can not change unfortunately my framework because it is one of the greatest on the world. But i have noticed that before JS code of the framework is fired i have for a while a URL with the parameter gclid.
Some lines below i have my Google Analytics tracking code. Obviously it tries to get gclid from the URL. But it is too late for him. The gclid parameter is gone when Google Analytics tries to read it.
So my question is: since i have gclid, is there any method of Google Analytics to pass it to him? Like say:
var gclid = getGClidBeforeItsToLate(); // i have it covered
// Awesome framework stuff
HeyGoogleAnalyticsHereYouGoItsYourGclidTakeCare(gclid);
?
Override the "location" field and append the gclid parameter.
if(gclid) {
ga('set', 'location', document.location + '?gclid=' + gclid);
}
ga('send','pageview')
You have to use the location field, not the "page" field (which takes the page path), since the latter does not change attribution even if you add parameters t the path.
If you have manually set campaign parameters ("utm parameters") you could set them via the campaignMedium/campaignSource/campaignName fields, but since you cannot get the individual campaign values from the gclid you have to overwrite the location (at which point GA will dismiss what it has gathered from the address bar of the browser and use the value you passed in).
I am using Google Analytics in an embedded form. This form will be placed on various websites, and I want to track the traffic with GA. Creating a new property in GA for each website that embeds the form is not an option. As such, I'm looking to track traffic from all the websites using one GA Tracking ID and segment the data by domain. However, I'm having trouble figuring out how to customize the GA code snippet to do that -- everything I find refers to the old classics GA code and not the new universal code. Can someone please help?
Thanks!
You do not need to customize the code, the domain is tracked automatically in GA in the "hostname" field. Go to your GA admin panel, set up a new view, create an "include" filter and set field to "hostname" and the value to the hostname that you want to track. Repeat for all your domains.
You can create up to 25 views per property.
If you do not need a permanent solution you can track everything to one view and create segments based on the value of the hostname field. Or even more ephemeral, set the secondary dimension to "hostname" in your data tables and use the filter in the upper right of the table to filter by value of the secondary dimension.
Google's official answer is here: https://support.google.com/analytics/answer/1012243?hl=en
by default GA is only showing URI, without hostname. You could follow above link, to add a filter to "include hostname in URI".
this video could be more instructive: https://www.youtube.com/watch?v=tcBg6QfgWR8
I'm building out a site that has predefined affiliate ids that are driving traffic to our sites. We currently use this paramater to track our seo work internally. Now we want to do the same through Google's Campaign Tracking at the Session level. The problem is we don't want to change our url, is it possible to manually build the Google campaign tracking pixel url? I'd like to take our affiliate ids and convert them over to a tracking campaign pixel for Google.
Seems like Google built this so all the tracking data must be in the url, is there a way to do the same tracking w/o the google data in the url?
Instead of:
http://www.mypage.com/?utm_source=google&utm_medium=cost-per-click
I want to use(javascript will do the rest):
http://www.mypage.com/?affid=123456
Turns out here is exactly what I was looking for:
https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiCampaignTracking
This is essentially doing everything the Google Campaign Tracking does but you have full control over what parameters are passed in the tracking pixel. I don't have to change or mess with the url, our in house tracking will work as it should, and now the google tracking pixel will be built as I specified.
You can programmatically set up a virtual pageview based on the affiliate id.
In an if statement, determine if you have an affiliate id. If you do, write some logic to build out the proper campaign, medium and source, then concatenate it to your URL. Pass that to GA via the trackPageview method instead of letting it do it's own thing.
Keep in mind that passing a virtual URL does replace it's default behavior, so you won't have the affid parameter in your content reports unless you build it in to the virtual pageview.