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
Related
I have added Google Tag Manager to our site, and using the data layer inserted several custom dimensions, including 'user_id'
Data Layer with user_id shown
The Google Analytics variable in Tag Manager is configured to pass these data layer variables into the coresponding dimensions:
Tag Manager Variable & Dimensions in Analytics
I know this is working as I am able to add this as a secondary dimension in Analytics when viewing reports:
Analytics with Dimension Shown
However, the user view that is created when I have set up the User-Id isnt showing anything:
Creating the User View
We installed Tag Manager using the recommended steps:
Installation of Tag Manager
Do we also need to add the 'Global Site Tag Tracking Code'?
How to Implement the User-ID in your tracking code
If not, what am I doing wrong?
You're actually REALLY close. You actually don't need to create the custom dimension.
The correct way is to set the userId field in your GA tag (I did it through a GA variable so it is applied everywhere).
Yes, that is exactly correct (what #XTOTHEL answered above), but for those who are reading this, I found these two blog posts helpful (esp if you are using GTM):
GA UA: https://www.analyticsmania.com/post/google-analytics-user-id-with-google-tag-manager/
GA4: https://www.analyticsmania.com/post/google-analytics-4-user-id/
And of course, the GA docs: https://support.google.com/tagmanager/answer/4565987?hl=en
I have multiple domains (like domainA.com, domainB.com, etc.). They are unrelated to each other. Each domain has its own tracking number.
I have created a single GA account named "tws".
Under "tws->Properties and Apps", I see these different domains.
When I now click a domain in the list "Properties and Apps", the right side "Data View" shows "All Website Data".
When I click "All Website Data", it doesn't show me the data of this website.
I can tell because no matter which domain I click, the data always stays the same.
Even when I click a domain which shouldn't have any visitors, it shows me the visitors of some other domain.
Does anybody see which mistake I made?
Thank you.
Here is an excerpt of GTM:
Now that I made the suggested changes in GTM, Chrome's tag analyzer shows this:
I looked at one of your domain (seen in the previous image).
And as you can see in the images below, you're sending hit analytics to all your properties... so I suggest you to review the configuration of your GTM and send hits to the right domain.
Solutions:
PREFERRED: use a lookup table to send hits to correct Property based domain.
Or:
use a separate GTM for each domain.
Or:
use separate Analytics tag in the same GTM for each domain (not preferred but working).
I have an extremely weird filter issue with Google Analytics and Shopify. It used to control spam referral issues and control page views for just the store.
A view is setup that includes only the store's subdomain and its checkout based on the hostname filter field. I have tried these filter patterns:
store\.domain\.com|.*shopify\.com
store\.domain\.com|checkout\.shopify\.com
^(store\.domain\.com|checkout\.shopify\.com)$
The only pages included have a hostname of store.domain.com. No pages on shopify.com ever get included. It's only when the filter is removed altogether that page views on the shopify.com start appearing.
Here's where it gets weirder.
I have an unfiltered view setup where I run the exact filter patterns on the hostname as an advanced segment. Pages on the sub-domain checkout.shopify.com show for any of the filter patterns.
Secondly, I confirm the pages disappearing in the analytics reports have a hostname that is exactly:
checkout.shopify.com
Any further debugging ideas? Possible explanations?
The reason why your filter isn't working is because the Checkout at Shopify uses virtual pageviews instead of the regular ones, in order to have neat names that make your reports and funnels clean instead of leaving a bunch of meaningless IDs like the ones you see in the URL. These pageviews don't contain a hostname.
Now you may be wondering why it worked in your advanced segments. If you check your Hostname report (under Audience > Technology > Network) you'll see the checkout.shopify.com hostname there, but with 0 sessions and some transactions. That's because it was the ecommerce tracking code that sent the hostname value that you saw in your segment, not the pageview.
One solution in this case is to create your filter in two steps.
1) Merge the Hostname and Request URI into Custom Field 1 with an Advanced filter. If Hostname is your Field A, make sure you leave "Field A Required" unchecked.
2) Filter the custom field for store.domain.com|/checkout
On a side note, my preferred method to avoid spam in to simply create a new property. You'd be surprised how most spammers only target UA-XXXXX-1 and leave alone all others properties. They are probably just using the Measurement Protocol to send fake data and they generate the IDs programatically instead of actually going through the trouble of finding the code on the site.
I hope that helps, and don't hesitate to contact me or Shopify's support if you need any extra help.
for some time in google Analytics I observe very busy with foreign sites. These are spam site. How can I protect?
Screen GA:
http://oi60.tinypic.com/2vctdae.jpg
These are called "Ghost Referrals" and the best way to rid yourself of them is to add a new view and create an Include filter for it.
Check out the full post http://blog.tylerbuchea.com/google-analytics-filtering-out-ghost-referrals/
First go the the Analytics Admin section and choose the Account and Property you'd like to apply the filter to. Then create a new view like "example.com (Ghost Referalls Filter)". Trust me on this create a new one and don't reuse your existing one. I'll explain later.
Add a new filter to your freshly created view. Then select the Custom tab, mark the Include radio button, and choose Hostname from the dropdown. Then you'll want to enter your sites hostnames separated with the OR operator "|" and make sure to add a backslash before each period. This will white list only your hostnames and block any other sites from sending fake data that muddy up your Analytics reports.
Example entry
example\.com|www\.example\.com|translate\.google\.com
So Why The New View?
If you add a filter to an existing view it will permanently change that view and all of the past data.
I Don't See Any Data
Unfortunately Analytics doesn't apply filters to past data. So all of the data in the filtered view will be from the day it was assigned onwards. Just give it a few days and you'll be using your original view less and less.
If your picture is what I think it is, its actually a GA issue. Its fake referral spam.
https://megalytic.com/blog/how-to-filter-out-fake-referrals-and-other-google-analytics-spam
We've accidentally placed the same Google Analytics tracking code on two different domains.
www.y.com
www.x.com
We've rectified the issue now but retrospectively, is there any way to filter that data going to the specific domain name www.x.com for example?
Note: this is not a duplicate of Google Analytics: Track two domains as one
You could add a filter to the view (profile) in question. That will remove the data that you don't want. Another option if you don't want to loose the data in the view would be to create a custom segment that you could use when ever you want to split the data out.
Update from Google+
You can search with regex
^/app/
in the small search bar (custom segment) in your page reports (e.g. Behavior -> Site Content -> All Pages), after which you can look at the aggregate metrics for all pages which start with /app/ (i.e. all the pages with different parameters).
If all the /app/.* have the same page title, you can look at the Behavior > Overview report, but choose Page Title as the dimension.