gabba gem not tracking different domains

2019-08-03 10:57发布

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条回答
我想做一个坏孩纸
2楼-- · 2019-08-03 11:42

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)

查看更多
登录 后发表回答