Partial IP Anonymization using DTM - google-analytics

Is there a way to anonymize IP based on the URL address. The site runs across many countries, and we need to anonymize the IPs for the traffic coming from a specific country only. The subdomains are different based on the countries.
My analytics setup utilizes DTM (Dynamic Tag manager) and is configured to send data to GA (Google Analytics)

You should be able to use the "Customize Page Code" field - test the url if your user comes from a domain that requires anonymization and if so set a call to anonymizeip.
if(location.hostname.indexOf('some_site.de') > -1) {
ga('set' 'anonymizeip' true);
}
Since the custom code is run before the first pageview this should work to anonymize the IP for that domain. I admit I haven't tested this, but you can look into the network tab, if the call to the Google servers contains the parameter "&aip" then the IP is anonymized.
Here is a pirated screenshot from the Adobe documentation to show where the Customize Page Code field is (bottom of the image). Hit the "open Editor" field to insert your code.

Related

Google analytics - allowed hosts

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.

Google analytics Direct vs Referral traffic for 2 sites being on same domain name

I have a site abc.com e.g. It has a UK and US variant with different content and based on country of access directs to abc.com/en-gb or abc.com/en-us.
Now in the site in the footer there is a link to our App-store website. Now that website too uses the same primary domain name of abc.com but at the proxy based on URL directs it to a completely separate installation of a stand-alone site which is abc.com/app-store.
Both the sites have different GA tracking code enabled. the abc.com corporate site has GA360 (Analytics pro) while the abc.com/app-store uses regular GA account. Basically no way the 2 are connected.
Now what I see is any traffic coming from abc.com/en-gb or abc.com/en-us to abc.com/app-store is being recognised as "Direct" traffic type in GA. While actually it is a "Referral" though they are both sites owned by us.
We need to somehow measure the traffic being sent to our app-store from our corporate site in the GA in the app-store for reporting purposes. We can track traffic sent from abc.com in the GA360 enabled on abc.com/en-gb and /en-us but then it is a different GA account and data store and needs manual sync up.
I had thought of using utm campaign source/medium - but that is giving false impression of bloated traffic as the UTM URL paramters remain even after landing on the destination site and for any filtering operation on the site it keeps reloading - giving the false impression of traffic coming from abc.com.
Any advice?
The reason abc.com/app-store GA account shows this in 'direct' because the referrer is the same domain. And Google will consider this as self-referrer.
GA doesn't care if you have 3 different GA set up in 3 different pages but the domain from which it is referred to, if it is different then it is fine else it considers it as 'direct'. Equivalent to user opening a bookmark.
How to solve this,
Use outbound event tracking on abc.com/en-gb & abc.com/en-us. But it will lead to manual merging of the data.
As UTM parameters are messing up your app store campaign data and filtering options, you can go with the ref parameter. I usually use it for tracking internal navigation. for example - abc.com/app-store?ref=main_site. You can easily filter out ref parameters from your view or create a segment. And it is considered different than the original URL, so no clashes.
Hope this helps

Can a private IP address change?

Okay, this may be a stupid question. I have setuped a Google Analytics account to analyze the traffic of my own site (online portfolio).
My question is: How can I exclude the traffic from me?
Can I just simply get my public IP address and exclude it? Will it change?
If it will, how can I effectively exclude the internal traffic? Many thanks!!!
Just set up Ghostery plugin on your main browser and use only this browser for working with Your site.
Simple and very effective.
Yes, your IP address is likely to change over time.
IP filtering is best used for corporate networks, which have static IP addresses (or range of IP addresses). IP filtering is unlikely to be useful for individuals.
The best way to filter out your own traffic would be to create a Custom Dimension for User Type, and have your CMS/Portfolio application fill out its value depending on visitor's log-in status.
1. Create a Custom Dimension in Google Analytics
Navigate to the Admin Section of Analytics, and create a new Custom Dimension for User Type.
For reference and/or more details, see the official Google
documentation about creating Custom
Dimensions.
2. Create filtered Views in Analytics
Still in Google Analytics, you can set up multiple Views and use filters to remove yourself from the traffic logged.
For example:
Leave the default View provided as a "Raw & Unfiltered View".
Create a new View, "Visitors only", and apply an "Exclude Filter" based on your Custom Dimension, preventing "Administrator" hits from being displayed.
For reference and/or more details, see the official Google
documentation about creating a
View and
managing View
filters.
3. Have your CMS/Portfolio print the user status for each view
For example:
When User is logged in as Administrator/Contributor, have the application output:
ga('set', 'dimension1', 'Administrator');
When User is anonymous, have the application output:
ga('set', 'dimension1', 'Visitor');
Unfortunately, you might have to look for plugins and/or do code it yourself, depending on your application.

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).

Can I use the same Google Analytics tag for a blog subdomain of my site as the main site?

I have my site.com and blog.mysite.com on a different IP address. Can I use the same Google analytics ID for both sites? Does Google analytics look at what IP address the recorded visitor information is from? If it doesn't, what prevents random sites from including your Google analytics tag and sending random data to your account?
You have to modify your script tag a little. Google's FAQs cover this:
http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55524
You can run any UA-XXXXX-YY on any website (any domain name, on any IP), it will end in your profile stats.
Yes, your stats could get completely messed up if some site would put your UA id on its site.
To prevent this, you can setup an include filter on your GA profiles, and Include only your domain names by using a regep like this "www.domain1.com|www.domain2.com|www.domain2.com" on the hostname field.
Be careful, the Include filter is exclusive (If you have 3 Include filters on the field hostname, only the first one will be applied).
The alternative is to create an advanced segment based on the hostname, you'll get mostly the same result but could be exposed to data sampling effects if you have a large audience. But it allows a quick fix afterwards, while filters need to be set before you get into trouble.
Sure. you can use the same for both. You will be able to segment traffic by domain name.

Resources