无法使用Ahoy gem Rails 5.1.3跟踪位置

时间:2017-11-22 21:32:25

标签: ruby-on-rails ruby ahoy

我刚刚在我的Rails 5.1.3应用程序中安装了ahoy gem。我将返回visitevent,但访问位置属性始终返回country: "Reserved"region: nilcity: nilpostal_code: nil。这是我按照Ahoy github上的指示实现的。任何身体都可以解释我失踪或做错的事情?这在生产和开发环境中都会发生。

的application.js

$(document).ready(function(){
  ahoy.trackAll();
});

的Gemfile

gem 'ahoy_matey'
# Did not include geocoder because it is detailed in the documents as a dependency.

访问示例:

[2] pry(main)> Visit.last
  Visit Load (0.5ms)  SELECT  "visits".* FROM "visits" ORDER BY "visits"."id" DESC LIMIT $1  [["LIMIT", 1]]
=> #<Visit:0x007fd045e04b48
 id: 2,
 visit_token: "7750594c-7163-46c1-8ec7-18f3069619d0",
 visitor_token: "efdcb332-742a-4de3-971b-c141f24ff0f6",
 ip: "74.174.236.84",
 user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36",
 referrer: nil,
 landing_page: "http://my_website.com/users/sign_in",
 user_id: nil,
 referring_domain: nil,
 search_keyword: nil,
 browser: "Chrome",
 os: "Mac OS X",
 device_type: "Desktop",
 screen_height: 800,
 screen_width: 1280,
 country: "Reserved",
 region: nil,
 city: nil,
 postal_code: nil,
 latitude: 0.0,
 longitude: 0.0,
 utm_source: nil,
 utm_medium: nil,
 utm_term: nil,
 utm_content: nil,
 utm_campaign: nil,
 started_at: Wed, 22 Nov 2017 21:10:52 UTC +00:00>

0 个答案:

没有答案