I am using Asynchronous google Analytics code in my website. Account key for Google Analytic which i am using for Live website in also in my local website environment.
but in my google analytics account the Url is of live website. suddenly i noticed that my Google Analytics is tracking the data from local environment as well and that is a huge huge problem. why its tracking from two different URLs.
Google Analytics will track any domain or URL onto which you have installed the Google Analytics Tracking Code (GATC). For analytics/tracking purposes, it does not matter to Google which URL you written your GA account, either at Admin -> Profile Settings or at Account List -> Account Settings.
For example, let's say that your current GA account number is "UA-12345678-1". You have installed your GATC with UA-12345678-1 onto "livewebsite.com" and onto "localenvironment.com". As long as the GA JavaScript file called "ga.js" can load and can connect to the Internet, then a GA cookie can be created and stored on your browser and the tracking information can be sent back to GA.
Assuming that you want to keep GATC installed on your local environment webpages, some possible solutions that may fix your dilemma would either be to create a filter to exclude your own traffic or install an entirely new, unique account number into your local environment:
'1. Exclude your own traffic from UA-12345678-1 by creating a new profile for UA-12345678-1. In the new profile, create and apply one of the following "Custom/Advanced" filters:
'a. "Include" traffic from "Hostname" of livewebsite.com
--or--
'b. "Exclude" traffic from "Hostname" of localenvironment.com
--or--
'c. "Exclude" traffic from "IP Address" of your local environment. For example, if your local environment uses the IP address 65.99.208.1, you would write the IP address into the Exclude IP Address advanced filter as: ^65.99.208.1$
More info here:
http://www.morevisibility.com/analyticsblog/clean-up-your-google-analytics-data-with-these-5-filters.html
'2. Create a second GA account (they're free to create):
'd. Install the new GA account number into the code of localenvironment.com. After installing the new GA account number (for example: UA-98765432-1) , you would continue using UA-12345678-1 on livewebsite.com without interference from your test environment, which would use UA-98765432-1 .
Related
We have integrated GA4 code in our web application for both prod and non-prod applications.
We are trying to get the seggerated user's traffic for prod and non-prod URL's in realtime.
prod URL: https://test.com
non-prod URL: https://test-dev.com
I accessed the prod URL and in real-time reporting applied the hostname filter for the prod URL, but I cannot see the traffic in the same, it shows the traffic in "all users".
Is this the BUG? or am I missing any steps here??
Thanks,
Abhishek
It is not possible to filter on Hostname in GA4 Realtime.
Your reports show three comparisons: 1) All Users, 2) Hostname includes the prod URL, and 3) Hostname includes the non-prod URL. No data is available for the second two reports. If you scroll down, there are "No data available" messages for the other cards. Example:
One solution is to tag your prod site and non-prod site to different web data streams in one GA4 property. Then, you could compare the different streams in the Realtime Reports.
The Google Analtyics Data API has a list of most of the dimensions & metric available in Realtime. For example, Hostname is not on the list.
You could use the Stream ID as a proxy for hostname, but only if you've got a stream for each of the environments.
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
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.
I have an Intranet application which is accessible from within company firewall. To track some specific pages, I want to implement Google Analytics in my Intranet application. This application is accessible from outside only when user system has some specific certificate installed.
Is it possible to implement Google Analytics in my Intranet application?
Will this Google analytics work inside company firewall?
How Google analytics work i.e. what is the actual flow of google analytics?
Yes, Google analytics can be used for internal web applications too. Please visit this URL which will clear your doubts. If you click on the given link and able to access analytics.js file from your internal network you can use Google analytics for your internal applications protected from corporate firewall.
Please note that after implementation, tracking data would be available around 24 hours only. So, you need to wait for 24 hours first. Even if you are not able to view the tracking data, please visit this link. You will find the possible reasons behind not working your analytics code.
In order for Analytics to generate reports for your corporate intranet
usage, your corporate network must be able to reach the Analytics
JavaScript file (analytics.js).
...
Your intranet must also be accessible
through a fully qualified domain name such as
http:// intranet.example.com. The Analytics JavaScript won't work if
your intranet can only be accessed using a domain name that isn't
fully qualified, such as http:// intranet
Ref: https://support.google.com/analytics/answer/1009688?hl=en
In your example, if a person without the certificate you mentioned can still reach the domain (that is, there is a public DNS entry for the domain name) even if they get an 'access denied' or similar message, the tracking should still work.
Google Analytics is Software as a Service and runs on the Google Servers. If your clients cannot reach the Google server than you cannot send tracking data and Google Analytics will not show anything. You may need to adjust your firewall rules to let calls to the Analytics servers pass (are you that you want a third party javascript to send data from your intranet to the internet, though ? There might be legal ramifications, too, after all implementing a script basically means to hand control of the clients to a third party).
If the server for your intranet is connected to the internet you could collect all hits in a log and pipe this to Google Analytics.
However Google Analytics might not be the best choice. You most certainly do not need campaign data, you probably do not have ecommerce in your company and depending on your type of company geo data and technology data might not be relevant (after all you probably know what computers your employees use and where they are). And for a page counter a self hosted solution will do just as well.
Google Analytics requires that you place a script on each page you wish to track. Whenever a page with the script is loaded, the script runs and sends data to GA, so your users must be connected to the internet as well as the intranet for their usage statistics to register. One security issue to consider is the titles of your intranet's pages will be sent externally across the intranet, which your IT security may have an issue with.
For basic intranet analytics, I'd recommend starting with Piwik which is open source and installs on your server.
It will give you a lot of initial usage data and if your customer decides they want more, you can look into more sophisticated products.
I have some problems with the google analytics not working on production, I have made some fixes and used some plugins to check that the information sent to google is ok, but the problem is I cannot test properly on my sandbox since I do not have the credentials for the analytics account used on production instance. I will not have access to that account and I do not want to create a dummy account linked to my sandbox because I cannot have my sandbox address indexed by google. Is there any way to install a local server that emulates GA? Or a way to create a GA account and prevent it from indexing my sandbox address? I have found the urchin software that would have given me the possibility to install a local sandbox, but this was discontinued by google and I was not able to find it anywhere.
If by "indexing" you mean "becoming a part of the Google search index an appearing in result pages", that is not in any way related to analytics. If you have a problem that your pages Urls show up in GA (which really is the whole point of Analytics) you can programmatically pass dummy urls to the tracker:
ga('send', {
'hitType': 'pageview',
'page': '/home' // pass a virtual adress here per page
});
That way your sites structure will not be recognizable in GA (however this will make testing more difficult).
If at all possible you should have Google Tag Manager installed on the live page. GTM has a preview mode that allows you to directly in the live site without affecting other users (tags are only visible to visitors with the preview cookie).
As for emulating locally, no, not really. If you still use asynchronous tracking (ga.js) you can use setlocalGifPath and _setLocalServerMode to have the tracking data send to your own server, but that will not give you the interface - it just means you can create a log file with the google parameters that you have to parse yourself.
Universal Analytics does not (to my knowledge) have corresponding methods (they are a remnant from urchin days when people wanted to reprocess their data locally. As you've said urchin is now defunct and it would have been too expensive for a bit of local testing in any case).