问题
I have a UA account which is connected to the following domain: http://www.mytestdomain.com with the following account id UA-123456-1
When i am using the Gem to track the domain it works well:
Gabba::Gabba.new('UA-123456-1', 'http://www.mytestdomain.com', user_agent).page_view('index', 'index.html')
But other domains can't be track:
Gabba::Gabba.new('UA-123456-1', 'http://www.notmydomain.com', user_agent).page_view('index', 'index.html')
What should i do to track others domains as well ?
related : Events sent to Google Analytics with Gabba don't have a hostname
回答1:
Instead of using the hostname "http://www.notmydomain.com" you should probably be using request.host
. so:
Gabba::Gabba.new('UA-123456-1', request.host, request.user_agent)
.page_view('index', request.fullpath)
If you still have problems seeing the hostname, make sure you don't have any filters filtering out the content in Google Analytics.
Also have a look at GabbaGMP, it makes it a little simpler in terms of coding, and also allows you to do geo tracking, which Gabba doesn't allow (doesn't currently support eCommerce analytics)
来源:https://stackoverflow.com/questions/24761941/gabba-gem-not-tracking-different-domains