gabba gem not tracking different domains

为君一笑 提交于 2019-12-13 01:54:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!