问题标签 [ahoy]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
736 浏览

ruby-on-rails - Rails & Ahoy:没有路线匹配 [GET] "/ahoy/visits"

我正在使用 Ahoy gem 来获取访问信息。但我注意到在生产中,我经常收到以下错误:

没有路线匹配 [GET] "/ahoy/visits"

但是回溯没有显示我识别的任何文件。这是完整的跟踪:

这只是一个爬取所有 URL 的机器人吗?如何根据跟踪找出它的来源?

0 投票
1 回答
361 浏览

jquery - 如何跟踪特定链接中的点击?

我正在使用 ahoy 宝石。我发现有一些方法ahoy.trackClicks();可以跟踪点击次数。但它也跟踪下拉和登录和注销的点击。我只想跟踪特定页面上的点击。我有一个带有广告的页面,点击该广告将导致带有外部页面的新标签。

虽然上面的 js 代码可以跟踪它,但是否可以只跟踪广告点击而不做其他事情?

0 投票
2 回答
3342 浏览

ruby-on-rails - json 数据中的 find_by()

我正在使用ahoygem 进行分析。在ahoy_events表中,我有properties一列 json 数据类型。我想根据该列查找特定数据。

假设我有

这作为数据,我想 find_by 类。

rails c我跑了Ahoy::Event.find_by(properties[:class]: "bigyapan-6"),它给了我一个错误

0 投票
1 回答
59 浏览

javascript - 事件运行结束后清除事件效果

我正在使用ahoy_mateygem 。我试图仅在单击特定链接时记录单击事件。

因此,我尝试执行以下操作:

它可以工作,但这里唯一的问题是,在我点击特定链接并且一切正常之后,如果我点击其他地方,那么它也会被记录下来。一旦点击存储在数据库中,有没有办法清除效果?

0 投票
2 回答
144 浏览

ruby-on-rails - 为 Analytics Ahoy gem 创建种子数据

我想为Ahoy Analytics Gem创建一些种子数据以进行演示

我将如何模拟页面访问,同时更改数据库中记录的日期以模拟过去的访问者数据?

感谢任何帮助谢谢

0 投票
2 回答
1040 浏览

ruby-on-rails - 查询 Ahoy Gem 事件

我在 Rails 4.2 应用程序中使用 Ahoy gem。Ahoy Events 存储具有许多文本属性和一个properties包含我要查询的数据的属性的事件。例如,这是我通过 rails 控制台返回的最后一个事件

>> Ahoy::Event.last Ahoy::Event Load (3.8ms) SELECT "ahoy_events".* FROM "ahoy_events" ORDER BY "ahoy_events"."id" DESC LIMIT 1 => #<Ahoy::Event id: "fffff17f-44e6-41d7-9c32-fa895338f54e", visit_id: "6b05b1ca-3863-46da-9c48-a3ab5fa4a9ee", user_id: 1, name: "$click", properties: {"tag"=>"a", "page"=>"/conversations/2", "text"=>"View", "href"=>"/conversations/2"}, time: "2015-08-23 13:25:51">

我将如何检索 properties['text'] = 'View' 的所有事件

我努力了Ahoy::Event.where(:properties['text'] => 'View').count

返回:```

Ahoy::Event.where(:properties['text'] => 'View').count NoMethodError: undefined method to_sym' for nil:NilClass from /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/sanitization.rb:59:inblock in expand_hash_conditions_for_aggregates'来自/Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0 /gems/activerecord-4.2.5.1/lib/active_record/sanitization.rb:58:in each' from /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/sanitization.rb:58:inexpand_hash_conditions_for_aggregates' 来自 /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/activerecord-4.2.5.1 /lib/active_record/relation/query_methods.rb:957:build_where' from /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/relation/query_methods.rb:584:in在哪里!来自/Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/relation/query_methods.rb:574:inwhere' from /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/querying.rb:10:in哪里'来自(irb):13来自/Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/console.rb:110:instart' from /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/console.rb:9:in从 /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:68:in console' from /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:inrun_command 开始' 来自 /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands.rb:17:in<top (required)>' from /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in来自 /Users/dariusgoore/development/ blackops/.bundle/gems/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in block in require' from /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:inload_dependency' 来自 /Users/dariusgoore/development/blackops/.bundle/gems/ruby /2.2.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:inrequire' from /Users/dariusgoore/development/blackops/bin/rails:8:in'来自 /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:in load' from /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:inblock in load' 来自 /Users/dariusgoore /development/blackops/.bundle/gems/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in load_dependency' from /Users/dariusgoore/development/blackops/.bundle/gems/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:268:inload' 来自 /Users/dariusgoore/.rubies/ruby-2.2。 1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire' from /Users/dariusgoore/.rubies/ruby-2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in需要'```

我在网上查找了查询哈希属性但没有成功。非常感谢任何指导。

0 投票
0 回答
86 浏览

ruby - Rails 3 -> 用于用户活动跟踪的 Ahoy 插件 -> 安装错误

我已经按照链接中的说明安装了 Gem Ahoy -> https://github.com/ankane/ahoy

将此行添加到应用程序的 Gemfile:

并在 jQuery 之后添加 app/assets/javascripts/application.js 中的 javascript 文件。

MySQL 或 SQLite

将 activeuuid 添加到您的 Gemfile。

并运行:

最后一个命令产生以下错误

0 投票
1 回答
163 浏览

ruby-on-rails - 在我的 Rails 应用程序中,我使用操作邮件程序向用户发送邮件。跟踪邮件是否打开或单击

要跟踪邮件是否打开或单击,我正在使用 ahoy_email。

类 UserMailer < ApplicationMailer track utm_campaign: "boom" default from: 'myemailid'

打开工作正常,但即使在我单击电子邮件中的链接后,单击表中仍显示 nil。对这个问题有任何想法吗?

0 投票
1 回答
1003 浏览

ruby-on-rails - Ahoy的访问如何进行?

我想跟踪点击我的链接的访问。

我需要知道每个链接的浏览器、操作系统...的百分比。

这是否意味着我应该添加它link.rb

但是在多次点击链接后,并没有生成链接的访问量。

我真的不知道 Ahoy 的访问是如何工作的,何时创建一个新的访问。

0 投票
1 回答
1052 浏览

ruby-on-rails - 查询 Ahoy gem 属性哈希

我正在使用 Ahoy gem 在 Rails 4 应用程序中记录用户操作。事件被记录并存储在 Ahoy::Event 表中。每个事件都有一个properties以文本形式存储的哈希属性。在这种情况下,我试图返回特定文章的文章浏览次数。

我在此处的 gem 文档中遵循建议的语法:https ://github.com/ankane/ahoy#querying-properties ,它提供了一个Ahoy::Event.where("properties LIKE '%\"store_id\": \"1\"%'").count查询属性文本哈希的示例,但我无法返回准确的结果。

这是我正在跟踪以进行测试的控制器事件:

def show @article = Article.friendly.find(params[:id]) ... ahoy.track "Viewed article", article_id: @article.id ... end

在控制台中,正如预期的那样,当我搜索名称为“已查看文章”的文章时,我可以看到返回了一个事件:

Ahoy::Event.where(name: "Viewed article") Ahoy::Event Load (89.1ms) SELECT "ahoy_events".* FROM "ahoy_events" WHERE "ahoy_events"."name" = $1 [["name", "Viewed article"]] => #<ActiveRecord::Relation [#<Ahoy::Event id: "6cda3790-625d-4b73-8ef0-262a26b29618", visit_id: "2d56efa6-3590-4a64-acec-c0fd0ba07727", user_id: nil, name: "Viewed article", properties: {"article_id"=>562}, time: "2016-06-03 18:49:28">]>

但是当我尝试通过查询具有相应 article_id 的事件来查找相同的事件时,找不到该事件:

Ahoy::Event.where("properties LIKE '%\"article_id\": \"562\"%'").count (207.5ms) SELECT COUNT(*) FROM "ahoy_events" WHERE (properties LIKE '%"article_id": "562"%') => 0

任何建议都非常感谢。