We have a CMS and a SAAS application, one is on .co.uk and the app is on .com
we have set up cross domain tracking in google analytics, so we can see the users interaction on both domains. What we want to be able to do in google analytics is exclude users that are a logged in.
it feels like we just need to add a custom variable to the gtag code in the head, but I can't find anything that feels like the correct way to do this. lots of articles talk about excluding based on a /login url.
Here you can find documentation on how to add custom dimensions and metrics with gtag.js: https://developers.google.com/analytics/devguides/collection/gtagjs/custom-dims-mets
You have to manage the code based on login (only when user is logged). Set the custom dimension with hit scope.
Then you can create a report applying a segment to exclude interactions or sessions that contain that dimension.
Related
I have a company domain google site and enabled google analytics account. Could somebody advice if it is possible to view same domain site visitors by name?
I want to track who of my colleagues visited my site and what is the frequency.
Thanks.
In order to connect a user in Google Analytics to a person, you'd need some sort of system to make the connection. This could be a login, a form, a url parameter, or something like that, where at a certain point you know who they actually are. At that point, you can assign them an ID (in a custom dimension) and make reports tracking their behavior.
It is worth noting (as above) that you can't store personal info in Google Analytics - so the ID would have to be non-identifying, like a GUID or random, numerical ID.
Some strategies for connecting website users to individuals include:
Email Marketing - Many email marketing companies allow you to pass a unique identifier in the URL of anything they click. You could then read this url parameter with javascript and assign it to a custom dimension in Google Analytics.
Login/SignUp - You might have some content behind a login-wall. For example, in order to download a document, you make the user fill out some personal information (like an email and their name), then email a link to the document to them. Once you have the user's information in your system (via the form submission), you can grab the user's ID from the submission.
Manual Parameter - Similar to the "Email" one, you could just email your colleagues a link to the website with a custom ID on each link. Just read that parameter from the URL with javascript and assign it to a custom dimension.
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).
There are multiple profiles on my website and each user is managing his/her profile himself. I am trying to find the most efficient way to present analytics of each profile to its owner. Here are 3 ways I found:
Record each and every hit made on a profile page against that profile. This is not just count of hits, this requires to record IP, country, referrer, search terms etc. against each hit. This would require me to manage a huge database as there would be a lot of hits on each page. And a lots of processing on this database. Even if I have to de this, what database is recommended for such use?
Use Google Analytics on each page. But I am not sure that Google Analytics provide an API to fetch Analytics for individual pages.
Use some open source solution like piwik. Again I'm not sure if they provide per page analytics or not.
Please suggest the pros and cons of using each approach.
Update: More explanation - Think of it like a facebook page where each user can see hits on his page. What solution you'd suggest?
For Piwik, you can create a site id for each user, because you are allowed unlimited site ids with Piwik. You can can use a tracker with that user siteid, so when your member logs in, they get data only on their pages. You might also want to look at using custom variables and use the Piwik API to filter data.
Check here for info on multi-tracker: http://piwik.org/docs/javascript-tracking/#toc-multiple-piwik-trackers
Using the Google Analytics API I would like to display the domain associated with each GA profile. Is this possible or is there another way to do it? I have been unable to find any documentation for the domain.
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceAccountFeed.html#accountResponse
http://code.google.com/apis/analytics/docs/mgmt/mgmtFeedReference.html#profileFeed
I can't use profileName because depending on how the user has their GA account setup, it may just be a string and not a domain.
One thing you might do is perform a query using ga:hostnames as the dimension and either ga:visits or ga:pageviews as metrics. This will yield a chart of the host name (what is in the browser address bar) to reach that site. Sort of a hack in a way. Technically you can use a single GA Tracking code on multiple sites. So there is no "Official" domain name associated with a profile.
Unfortunately, I don't think it's possible with the current API. Furthermore, you can't explicitly depend upon the domain they enter as the only domain the profile is tracking since there is further customization that allows the user to specify if they want to track subdomains and/or top-level domains. I believe your only option is to ask the user the same information Google asks the user and help the user understand they will have to manually keep two lists in sync due to limitations of the Google API.
I have a website with 2 domains. I am trying to track the domains separately. I have both domains inside the same GA account - each domain has a filter applied to it to exclude the other's domain (both with and without the www). It looks like the domains are still being tracked together. How would I go about separating these 2 for different results?
Thanks!
What you're doing now is sending all the traffic to one account (say, UA-XXXX-1), and then using filters to separate them out. This is an imperfect solution, since filters have odd session-related quirks that make them less than ideal for tracking completely separate domains.
To completely separate the results, you need to create separate new web properties within your Google Analytics accounts , so that instead of tracking the second domain on UA-XXXX-1 and filtering, to send the data to UA-XXXX-2. It will roll up in the same area of your analytics account, but it will totally separate and segment the data.
You can read more about the organizational concepts here at this excellent Google Analytics Help Center walkthrough.
To set this up, you'll setup a new profile within the account and select "Add a profile for a new domain" as your option. There's a detailed walk through here.