J!Extensions Store™
Faq Why the Google Analytics integration shows stats for a different domain?
Why the Google Analytics integration shows stats for a different domain?
Created on:Sunday, 08 March 2015 10:44

When you connect to your Google Analytics account through the JSitemap Professional integration, if your Google account has more than one property website, by default Google will return stats for the last added property domain.

In this case you can specify a particular domain available in your Google Analytics account for which you want to retrieve stats, to do this simply use the configuration parameter 'Site domain' as shown in the picture below and set the needed domain address. If it continues to show stats for a different domain compared to the one you entered, it simply means that the domain does not match.


Moreover you can directly monitor all the real domains assigned to your Google Analytics account and pick up the correct one. To do this, you have to leave empty the 'Site domain' parameter and enable the parameter 'Advanced settings' -> 'Enable PHP debug' in JSitemap configuration. After that, when you open the Google Analytics integration you will see the list of real domains available for your Google Analytics account used to login.


Take care that the domain specified must match exactly the one registered in your Google account, thus it must use the same protocol, the same prefix if any, etc. If you have registered your website to Google as http://mydomain.com and you specify in JSitemap the preferred domain as http://www.mydomain.com or https://mydomain.com it won't work and Google will continue to fallback to the last added property domain.

Keep in mind that if you register a Google Analytics property as http://www.mywebsite.com and you change it at a later time for example to https://mywebsite.com, despite the fact that Google Analytics shows the new domain https://mywebsite.com in the Google Admin console, it internally never changes the original domain that continues to be the original one http://www.mywebsite.com. The original internal link will continue to be used even for the API integration with JSitemap that needs to be configured for http://www.mywebsite.com and not https://mywebsite.com. You must delete and re-create a new property in Google Analytics using the new domain https://mywebsite.com from the beginning to actually have it changed.

As an alternative you can use the method based on the UA code, in this way the account and domain chosen will be matched through the Google Analytics UA code instead that through the domain URL.
Just copy/paste it in the field below and enable the parameter 'Use UA code for Google Analytics API'.

googleanalytics ua code

IMPORTANT! It's required that you register your property using the 'Web' platform in your Google Analytics account, otherwise Google won't make your property available for the API. Google does not support the usage of the Google Analytics API for 'Apps' and 'Apps and web' platforms.
googleanalytics ua code

Useful Links: