mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Fix ahoy tracking and visits
This commit is contained in:
parent
b54e3f7ab9
commit
3bb73f27cf
6 changed files with 38 additions and 21 deletions
35
Gemfile.lock
35
Gemfile.lock
|
|
@ -57,19 +57,18 @@ GEM
|
|||
awesome_nested_set (>= 2.0)
|
||||
acts_as_list (0.9.7)
|
||||
activerecord (>= 3.0)
|
||||
addressable (2.5.1)
|
||||
public_suffix (~> 2.0, >= 2.0.2)
|
||||
ahoy_matey (1.6.0)
|
||||
addressable (2.5.2)
|
||||
public_suffix (>= 2.0.2, < 4.0)
|
||||
ahoy_matey (2.1.0)
|
||||
addressable
|
||||
browser (~> 2.0)
|
||||
geocoder
|
||||
rack-attack (< 6)
|
||||
railties
|
||||
referer-parser (>= 0.3.0)
|
||||
device_detector
|
||||
geocoder (>= 1.4.5)
|
||||
railties (>= 4.2)
|
||||
referer-parser (>= 0.3)
|
||||
request_store
|
||||
safely_block (>= 0.1.1)
|
||||
safely_block (>= 0.2.1)
|
||||
user_agent_parser
|
||||
uuidtools
|
||||
airbrake (7.1.1)
|
||||
airbrake-ruby (~> 2.5)
|
||||
airbrake-ruby (2.7.0)
|
||||
|
|
@ -92,7 +91,7 @@ GEM
|
|||
bootstrap-switch-rails (3.0.2)
|
||||
bootstrap3-datetimepicker-rails (3.0.3)
|
||||
momentjs-rails (>= 2.8.1)
|
||||
browser (2.5.1)
|
||||
browser (2.5.3)
|
||||
builder (3.2.3)
|
||||
byebug (9.0.6)
|
||||
cancancan (2.0.0)
|
||||
|
|
@ -150,6 +149,7 @@ GEM
|
|||
delayed_job_active_record (4.1.2)
|
||||
activerecord (>= 3.0, < 5.2)
|
||||
delayed_job (>= 3.0, < 5)
|
||||
device_detector (1.0.1)
|
||||
devise (4.4.3)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
|
|
@ -166,7 +166,7 @@ GEM
|
|||
dotenv-rails (2.2.1)
|
||||
dotenv (= 2.2.1)
|
||||
railties (>= 3.2, < 5.2)
|
||||
errbase (0.0.3)
|
||||
errbase (0.1.0)
|
||||
erubis (2.7.0)
|
||||
execjs (2.6.0)
|
||||
factory_girl (4.5.0)
|
||||
|
|
@ -189,7 +189,7 @@ GEM
|
|||
actionpack (>= 3.2.13)
|
||||
formtastic-bootstrap (3.1.1)
|
||||
formtastic (>= 3.0)
|
||||
geocoder (1.4.4)
|
||||
geocoder (1.4.9)
|
||||
globalid (0.4.0)
|
||||
activesupport (>= 4.2.0)
|
||||
gravtastic (3.2.6)
|
||||
|
|
@ -295,7 +295,7 @@ GEM
|
|||
nenv (0.3.0)
|
||||
netrc (0.11.0)
|
||||
nio4r (2.1.0)
|
||||
nokogiri (1.8.2)
|
||||
nokogiri (1.8.3)
|
||||
mini_portile2 (~> 2.3.0)
|
||||
notiffany (0.1.1)
|
||||
nenv (~> 0.1)
|
||||
|
|
@ -356,11 +356,9 @@ GEM
|
|||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.8.1)
|
||||
slop (~> 3.4)
|
||||
public_suffix (2.0.5)
|
||||
public_suffix (3.0.2)
|
||||
puma (3.10.0)
|
||||
rack (2.0.5)
|
||||
rack-attack (5.0.1)
|
||||
rack
|
||||
rack-openid (1.3.1)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
|
|
@ -484,7 +482,7 @@ GEM
|
|||
ruby_dep (1.5.0)
|
||||
rubyzip (1.2.1)
|
||||
safe_yaml (1.0.4)
|
||||
safely_block (0.2.0)
|
||||
safely_block (0.2.1)
|
||||
errbase
|
||||
sass (3.2.19)
|
||||
sass-rails (5.0.6)
|
||||
|
|
@ -546,8 +544,7 @@ GEM
|
|||
unobtrusive_flash (3.1.0)
|
||||
railties
|
||||
url (0.3.2)
|
||||
user_agent_parser (2.4.0)
|
||||
uuidtools (2.1.5)
|
||||
user_agent_parser (2.4.1)
|
||||
warden (1.2.7)
|
||||
rack (>= 1.0)
|
||||
web-console (2.3.0)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
module Ahoy
|
||||
class Event < ApplicationRecord
|
||||
include Ahoy::QueryMethods
|
||||
self.table_name = 'ahoy_events'
|
||||
|
||||
belongs_to :visit
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
module Ahoy
|
||||
class Store < Ahoy::Stores::ActiveRecordStore
|
||||
# customize here
|
||||
class Store < Ahoy::DatabaseStore
|
||||
def visit_model
|
||||
Visit
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ Osem::Application.routes.draw do
|
|||
path: 'accounts'
|
||||
end
|
||||
|
||||
mount Ahoy::Engine => '/ahoy'
|
||||
|
||||
# Use letter_opener_web to open mails in browser (e.g. necessary for Vagrant)
|
||||
if Rails.env.development?
|
||||
mount LetterOpenerWeb::Engine, at: "/letter_opener"
|
||||
|
|
|
|||
11
db/migrate/20180312100045_create_ahoy_visits_and_events.rb
Normal file
11
db/migrate/20180312100045_create_ahoy_visits_and_events.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateAhoyVisitsAndEvents < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :visits, :visit_token, :string
|
||||
add_column :visits, :visitor_token, :string
|
||||
|
||||
add_index :visits, [:visit_token], unique: true
|
||||
add_index :ahoy_events, [:name, :time]
|
||||
end
|
||||
end
|
||||
|
|
@ -18,6 +18,7 @@ ActiveRecord::Schema.define(version: 20180316220446) do
|
|||
t.string "name"
|
||||
t.text "properties"
|
||||
t.datetime "time"
|
||||
t.index ["name", "time"], name: "index_ahoy_events_on_name_and_time"
|
||||
t.index ["time"], name: "index_ahoy_events_on_time"
|
||||
t.index ["user_id"], name: "index_ahoy_events_on_user_id"
|
||||
t.index ["visit_id"], name: "index_ahoy_events_on_visit_id"
|
||||
|
|
@ -651,7 +652,10 @@ ActiveRecord::Schema.define(version: 20180316220446) do
|
|||
t.string "utm_content"
|
||||
t.string "utm_campaign"
|
||||
t.datetime "started_at"
|
||||
t.string "visit_token"
|
||||
t.string "visitor_token"
|
||||
t.index ["user_id"], name: "index_visits_on_user_id"
|
||||
t.index ["visit_token"], name: "index_visits_on_visit_token", unique: true
|
||||
end
|
||||
|
||||
create_table "votes", force: :cascade do |t|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue