sojourn 1.0.0.pre → 1.0.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sojourn/request.rb +18 -1
- data/lib/sojourn/tracker.rb +1 -0
- data/lib/sojourn/version.rb +1 -1
- data/sojourn.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dde9bf6c84552264bd06b6465dcbf764952eb15f
|
4
|
+
data.tar.gz: a45e882088fb6d3e3cb4bed30a49a5e3e74c99e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ade417af7eb156d6d1e1d424e14bc500bdb47373367b15a0feb4700f7ab0a7489b04398917410231c5dad1a4ff2a2b1c99dd582cfb1139d68b858cfd48662864
|
7
|
+
data.tar.gz: 027a5f0c51b26ba6672811e855dde81bcc73a35bc1c639e1e2947fbbd229982de292db271293987a2e193c0570e7c7de0e001c6b291526f9c16be51cbb0c4553
|
data/lib/sojourn/request.rb
CHANGED
@@ -2,6 +2,7 @@ require_relative 'campaign'
|
|
2
2
|
require_relative 'browser'
|
3
3
|
require_relative 'serializers/symbol'
|
4
4
|
require 'addressable/uri'
|
5
|
+
require 'referer-parser'
|
5
6
|
|
6
7
|
module Sojourn
|
7
8
|
class Request < ActiveRecord::Base
|
@@ -32,7 +33,7 @@ module Sojourn
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def outside_referer?
|
35
|
-
referer.present? &&
|
36
|
+
referer.present? && referer_host != host
|
36
37
|
end
|
37
38
|
|
38
39
|
def any_utm_data?
|
@@ -55,8 +56,24 @@ module Sojourn
|
|
55
56
|
}
|
56
57
|
end
|
57
58
|
|
59
|
+
def referer_data
|
60
|
+
return @referer_data if @referer_data
|
61
|
+
p = RefererParser::Parser.new.parse(referer)
|
62
|
+
@referer_data = {
|
63
|
+
known: p[:known],
|
64
|
+
host: referer_host,
|
65
|
+
source: p[:source],
|
66
|
+
medium: p[:medium],
|
67
|
+
term: p[:term]
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
58
71
|
private
|
59
72
|
|
73
|
+
def referer_host
|
74
|
+
@referer_host ||= Addressable::URI.parse(referer).host
|
75
|
+
end
|
76
|
+
|
60
77
|
def downcased_params
|
61
78
|
params.each_with_object({}) { |(k, v), h| h[k.to_s.downcase] = v }
|
62
79
|
end
|
data/lib/sojourn/tracker.rb
CHANGED
@@ -73,6 +73,7 @@ module Sojourn
|
|
73
73
|
@ctx.sojourn_event_properties(properties) if @ctx.respond_to? :sojourn_event_properties
|
74
74
|
properties.merge!(campaign: request.tracked_params) if request.tracked_params.any?
|
75
75
|
properties.merge! browser: request.browser_data
|
76
|
+
properties.merge! referer: request.referer_data if request.referer.present?
|
76
77
|
properties
|
77
78
|
end
|
78
79
|
end
|
data/lib/sojourn/version.rb
CHANGED
data/sojourn.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sojourn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Smudge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.3.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: referer-parser
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.3.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.3.0
|
69
83
|
description: ' Sojourn tracks site visitors and sources, with the ability to recognise
|
70
84
|
multiple sources per visitor. Each time a new source is detected, sojourn tracks
|
71
85
|
the referer, utm data, and logged-in user (if any)'
|