Analytics
2.6K members online now
2.6K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Google Analytics call from several Domains

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

 

Hallo,

i want do call the same UA-????????-1 of Google Analytics by JavaScript with several Server-Domain-URLs.

eg.

http:\\server1.dyndns.org\html1.html

http:\\server2.dyndns.org\html2.html

http:\\server3.dyndns.org\html3.html

 

Each contains:

 <script>
   (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-????????-1', 'auto');
  ga('send', 'pageview');
</script>

 

The Problem is: I can only write one URL in PropertySettings->Default URL. So Google Analytics get only the Hits of one URL.

 

Is there any way to force Google Analytics to get the hits independend of the Default URL?

 

Thank You!

 

Joe

 

Re: Google Analytics call from several Domains

A T
Participant ✭ ✭ ✭
# 2
A T
Participant ✭ ✭ ✭
Even if you arite one url in Default url, GA will get data from all domains where the code is pasted.

You can aslo test it in relatim reports

OR

You can easily debug on the website with GA debugger:
https://chrome.google.com/webstore/detail/jnkmfdileelhofjcijamephohjechhna

You can check in chrome, console tab with 'Preserve log' turned ON.

Re: Google Analytics call from several Domains

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Thanks! You are right!

Unfortunately i have to Count the Hits also from:
W:/Applications/Doc-Manager/index.html
And also from an Windows-App who load the Page by html-String directly in an Browser-Control.

Why it don't work from Data or Browser-Control?

Re: Google Analytics call from several Domains

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
Think i got the Error: Cookie wirte filed. I have to activate Cookies.
Special Thanks for your help!

Initializing Google Analytics.
analytics_debug.js:9 Running command: ga("create", "UA-79240898-1", "auto")
analytics_debug.js:9 Creating new tracker: t0
analytics_debug.js:9 New visitor. Generating new clientId
analytics_debug.js:9 Cookie write failed.log @ analytics_debug.js:9 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
analytics_debug.js:9 Running command: ga("send", "pageview")
analytics_debug.js:9 Unallowed document protocol. Aborting hit.
analytics_debug.js:9 Running command: ga("set", "dimension1", "SOME_DIMENSION_VALUE")
analytics_debug.js:9 Running command: ga("set", "dimension2", "SOME_DIMENSION_VALUE")
analytics_debug.js:9 Running command: ga("set", "metric1", "123")
analytics_debug.js:9 Running command: ga("set", "metric2", "123")
analytics_debug.js:9 Registered new plugin: ga(provide, "render", Function)

Re: Google Analytics call from several Domains

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
I can't enable Cookies in my Browser-Control in VB.net.
Is there any way to run the Javascript Code without cookies?
To prevent the cookie-error...?

&lt;script&gt;
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObje​ct']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*ne​w Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g​;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga​');

ga('create', 'UA-????????-1', 'auto');
ga('send', 'pageview');

&lt;/script&gt;