Google analytics - allowed hosts - google-analytics

I'm seeing entries in my analytics data for pages that no longer exist.
This could be developers looking at legacy versions of a site, it could also be triggered by something like wayback machine.
Is there a way to either identify what hosts an analytics tracking pixel is being triggered on, or restrict analytics to only execute on either a set of domains/hosts or ip address
LinkedIn campaign manager and Hubspot have features where you can tell the tracking script what domains to include/exclude
This is different from excluding ip addresses when setting up filters
Thanks

you can use filters on view level (Universal Analytics, not GA4) in order to exclude or include specified domains to ga data. Keep in mind, adding or removing filters work for new collected data only. Maybe add an additional view, so one view contains all data (based on your ga setup). With this solution GA collects data but will not show the data in the filtered view.
In order to fire the ga tag on a specified domain, specify the host in the trigger in Google Tag Manager, if it is implemented on page. This setting the tag will not be fired on other domains.
If there is no Tag Management on the page, you can check the domain using js before firing the ga script.
Keep in mind, that it is possible to send data to GA without fireing the GA tag by using Measurement Protocol. So if a lot of spam data appears in the interface, may add additional filters to exclude this data aswell.

Related

Can Client ID be Used to Retroactively Filter Internal Traffic?

With the goal of performing analysis that does not include staff traffic, I started following this guide to exclude internal visits which seemed great but apparently cannot work retroactively. In fact, I've heard differing opinions on if any sort of retroactive filtering of this sort can be done in GA at all. I'm very new to using GA, but one field I noticed is the Client ID, which seems to track browsers. If I could identify which Client ID's correspond to my coworker's browsers, could I use this to retroactively exclude them from analysis? This seems like it may work to me, but I have found no sources online suggesting this as an option.
If it matters, the analysis I am most interested in is tracking exit clicks.
ClientId is not a value normally available in Analytics reports, also if the coworker has deleted the cookies that value will be different.
This solution works for Univeral Analytics and not GA4.
With Google Tag Manager, you can create a configuration that allows you to filter out internal traffic.
In GA, you can create a custom dimension that tells GA which users are internal users and not. This information is passed on by Google Tag Manager via a query string.
For a step-by-step guide read: How to Filter Internal Traffic in Google Analytics with Google Tag Manager

Google Analytics: Which domains are sending data

Is there a way to tell which sites my Google Analytics tracking code is implemented on? I am suspecting it may have been used with different micro landing pages with different domains and sub-domains. (Our developers were testing a cross domain tracking but did not went as expected)
I could not figure out where to see this on my GA reports, tried to search it but all ends up explaining referrals list which I am not looking for:(
You can check what Hostnames are sending data to the GA reports for a Property, via the Audience > Technology > Network report. Change the Primary Dimension from Service Provider to Hostname.
Filters are not retroactive, so you can instead create and apply a Segment based on Conditions to Filter Sessions Include based on Hostname that exactly matches yourdomain.com.
Doing this will allow you too also view the historical data in your reports in relation to valid Hostname
More info on building segments from the GA Help Center
https://support.google.com/analytics/answer/3124493?hl=en

Can you implement google analytics with no domain binding?

We have a web service which is installed on different stations. Each has a different ip and domain. we want all of them to report to the same suite.
Can this be done?
The JavaScript tracker for Google Analytics can be used if you allow calls to the Google Servers, if you allow your clients to execute JS and either can set cookies or provide a client id in some other way (must not be personally identifiable data).
If you cannot use Javascript then you could still collect data via the measurement protocol, although this might require substantial development effort.
The domain setting in the Google Analytics interface does not affect data collection, it is used in the (soon to be removed) in-page analytics feature and as base url for the "open document" feature in the behavior reports.
Google Analytics does not collect by domain, but by property ID (UA-XXXXXXX-X), else cross-domain tracking would not be possible (it is actually a documented feature).
Cross domain tracking would be important if somebody could hop from one of your stations/domains to the other and you wanted this to be tracked as a single session. This does not seem to be your use case.
The only pitfall is that the reports display page paths, not full URIs. So if you have similar paths on all your stations the metrics for the page paths will be lumped together unless you do a breakdown by hostname. A common workaround is to add a filter to your data view that prepends the hostname to the path, or to provide custom paths in the first place.
But basically this is not a problem. If you do not need cross domain tracking you'll be okay if you dump the same tracking code in all your sites.

Tracking traffic of individual microsites Google Analytics

I have a web site which has many microsites.
I want to use Google Analytics to track the traffic of each individual Microsite as opposed to tracking traffic of the whole site?
I have looked at Google Tag Manager, but I am not sure if this is the right solution - how can this be done?
Thanks
There's two basic ways in which this can be done:
If you don't care about inter-microsite traffic, you can just create a different GA property for every microsite and use Google Tag Manager to create your GA tracking tag with the right property ID depending on the hostname (using a lookup table variable, for example).
If you want to be able to see traffic flow between your microsites (i.e. not have a visitor navigating from one site to another show up as a referral but as the same session), then you should use the same GA property for all sites and set up cross domain tracking. Then inside your GA property, you can set up different views based on the hostname dimension of the hits.

Can I use Google Tag Manager to collect analytics from mulitple domains?

The set-up:
1 site, 2 domains: = mysite.com and mysite.co.uk
These 2 domains use DNS to point to the same site (IP).
There is 1 snippet of Google Tag Manager (GTM) code just after the opening <body> tag of the site (every page).
In the GTM container, I have added both domains on the "Container Settings" page.
There is one Google Analytics (GA) account which only contains the .co.uk domain. (An analytics account can only contain 1 domain.)
A tag has been set up in GTM with the type of Google Analytics and it has the UA code from the 1 GA account added.
A rule has been added to fire on all pages
Now, I don't care whether someone visits via .com or .co.uk, but I want to capture combined analytics for both. My questions is, with the way I've set things up using GTM, will GA save data for both domains ie mysite.com and mysite.co.uk, or do I need to set things up another way to achieve this? Ideally, I don't want to go down the forwarding route i.e. forward all traffic from .com to .co.uk.
First a bit of pedantry: Google Tag Manager cannot even collect informatiom from a single domain (it's not a tracking tool). And while you can only enter one domain in Google Analytics that domain setting serves no actual purpose; a Google Analytics account can track multiple domains in different "properties" (porperties are sections in an account that each have a unique id) or in a single property via cross domain tracking. Cross Domain tracking is used if you want to treat multiple domains as a single presence on the web (i.e. if you have a website and a shop with different domains, they still belong together).
Now, the way you have set things up data will be collected from both domains. There are at least two caveats:
1) If users can switch between domains inside a session (go from .com to .co.uk and back) their sessions will be interrupted and Google Analytics will register multiple visitors (that's because users are tracked via cookies which are domain specific). To avoid that you'd need to set up cross domain tracking (and how you would do that depends on if you are using Universal Analytics or asynchronous code. Look at your tracking code, if it contains a line that starts "ga("send"...." your are using analytics. If it contains lines that start with _gaq.push you use asynchronous code).
Cross domain tracking documentation for UNiversal Analytics (analytics.js)
Cross domain tracking for asynchronous code (ga.js)
2) By default Google Analytics tracks only the path, not the domain. If pages on both domains have the same path they will be displayed in aggregated form in the reports, that is if you have an index.php on both pages the visits for both will be added up. Maybe that's just fine with you, if they show the same content in any case. Else you'd either have to use "hostname" as a second dimension (which is not a sticky setting, you would need to re-apply that every time you switch to another report), or you create a filter on your view that includes the hostname in the reports.
Those caveats are relevant because data will show up in any case and will look perfectly okay even if it's not (even if you decide that those two things do not bother you you need to take them into account when you interpret the data).

Resources