3

我刚刚将 ahoy gem 安装到我的 Rails 5.1.3 应用程序中。我正在返回visitevent,但访问位置属性总是返回country: "Reserved", region: nil, city: nil, postal_code: nil。这是我按照 Ahoy github 上的说明实施的。任何机构都可以阐明我错过了什么或做错了什么?这发生在生产和开发环境中。

应用程序.js

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

宝石文件

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>
4

0 回答 0