gosquared 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +34 -16
- data/lib/compatibility.rb +3 -0
- data/lib/config.rb +1 -1
- data/lib/gosquared.rb +4 -1
- data/lib/gosquared/client.rb +2 -2
- data/lib/rails/generators/{go_squared → gosquared}/config/config_generator.rb +2 -2
- data/lib/rails/generators/{go_squared/config/templates/go_squared.rb.erb → gosquared/config/templates/gosquared.rb.erb} +1 -1
- data/lib/tracker_inject/injector.rb +1 -1
- data/lib/tracker_inject/railtie.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d967932ba27cf17815ddf7836dbbd969f5134e1
|
4
|
+
data.tar.gz: 7d6d2759059c45e3c5c90fe7eb0829e76bb30dd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaa7ddda82cf174d6b294b5604306deea789443eafaa33eb2dfc528a2a82791885a4b2ab8d13fafc370b12e6b98eadc14cfde2ca7f64a231b5dc6061ad13fec0
|
7
|
+
data.tar.gz: a0daf661154404ce33a3babc590f3ce9c03a14434c36e70ff16a9bac262909edb4b361559d9f8b6665b599c5a4fbddf68c16b604462732f1f6d1a2728f182f42
|
data/README.md
CHANGED
@@ -8,6 +8,9 @@ This gems works with the [GoSquared API](https://www.gosquared.com/docs/api/), m
|
|
8
8
|
|
9
9
|
All functions listed in the API documentation are methods you can call on the GoSquared class.
|
10
10
|
|
11
|
+
You can generate an API key from your [GoSquared Account Settings](https://www.gosquared.com/settings/api).
|
12
|
+
|
13
|
+
|
11
14
|
#Installation
|
12
15
|
|
13
16
|
```ruby
|
@@ -20,14 +23,22 @@ Then require GoSquared in your application
|
|
20
23
|
require 'gosquared'
|
21
24
|
```
|
22
25
|
|
23
|
-
|
26
|
+
### Quickly install Analytics and Chat
|
27
|
+
|
28
|
+
GoSquared uses a javascript code snippet to track pageviews and optionally load the GoSquared Live Chat widget.
|
29
|
+
If you want to, you can quickly add the the code to all of your Rails’ views by running this:
|
24
30
|
|
25
31
|
```ruby
|
26
|
-
rails generate
|
32
|
+
rails generate gosquared:config 'your_project_token'
|
27
33
|
```
|
28
34
|
|
29
|
-
This will insert a
|
35
|
+
This will insert a `<script>` tag automatically before the closing `</body>` tag on each view rendered.
|
30
36
|
|
37
|
+
After generating your config file, if there are any controllers you would prefer not to have the tracking code automatically inserted in, you'll just need to add the following to that specific controller:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
skip_after_action :add_script
|
41
|
+
```
|
31
42
|
|
32
43
|
#Tracking API
|
33
44
|
This is for sending data to GoSquared. It allows you to track:
|
@@ -38,7 +49,7 @@ This is for sending data to GoSquared. It allows you to track:
|
|
38
49
|
##Track Events
|
39
50
|
```ruby
|
40
51
|
|
41
|
-
gs =
|
52
|
+
gs = Gosquared::RubyLibrary.new("your_API_key","your_project_token")
|
42
53
|
|
43
54
|
gs.tracking.event({ event: { name: 'event' } })
|
44
55
|
|
@@ -48,7 +59,7 @@ gs.tracking.post
|
|
48
59
|
|
49
60
|
#posts the data to the 'GoSquared Tracking' endpoint
|
50
61
|
|
51
|
-
|
62
|
+
Response Message: OK
|
52
63
|
=> #<Net::HTTPOK 200 OK readbody=true>
|
53
64
|
|
54
65
|
```
|
@@ -56,7 +67,7 @@ Reponse Message: OK
|
|
56
67
|
##Track Transactions
|
57
68
|
|
58
69
|
```ruby
|
59
|
-
gs =
|
70
|
+
gs = Gosquared::RubyLibrary.new("your_API_key","your_project_token")
|
60
71
|
|
61
72
|
gs.tracking.transaction({
|
62
73
|
transaction: { id: "1", revenue: 50, quantity: 1,
|
@@ -65,13 +76,20 @@ gs.tracking.transaction({
|
|
65
76
|
|
66
77
|
gs.tracking.post
|
67
78
|
|
68
|
-
|
79
|
+
Response Message: OK
|
69
80
|
=> #<Net::HTTPOK 200 OK readbody=true>
|
70
81
|
```
|
71
82
|
|
72
|
-
##
|
83
|
+
##Create or Update People profiles
|
84
|
+
|
85
|
+
This method is useful for importing existing user profiles into GoSquared people and updating profiles you have already added.
|
86
|
+
|
87
|
+
It's highly recommended that you also implement the front end [javascript 'identify' method](https://www.gosquared.com/docs/api/javascript-tracking-code/identify-users) on your site. This enables us to track a the user's session activity and browser information against their People profile.
|
88
|
+
|
89
|
+
We also recommend using an email address for the `person_id`. To do this, the email address needs to be prefixed with `email:` like in the example below.
|
90
|
+
|
73
91
|
```ruby
|
74
|
-
gs =
|
92
|
+
gs = Gosquared::RubyLibrary.new("your_API_key","your_project_token")
|
75
93
|
|
76
94
|
gs.tracking.identify({
|
77
95
|
person_id: "email:user@test.com", # Required
|
@@ -88,14 +106,14 @@ gs.tracking.identify({
|
|
88
106
|
|
89
107
|
# Custom properties
|
90
108
|
custom: {
|
91
|
-
# custom_property_name: "custom property value"
|
109
|
+
# custom_property_name: "custom property value" # You can track as many custom properties as you like
|
92
110
|
}
|
93
111
|
}
|
94
112
|
})
|
95
113
|
|
96
114
|
gs.tracking.post
|
97
115
|
|
98
|
-
|
116
|
+
Response Message: OK
|
99
117
|
=> #<Net::HTTPOK 200 OK readbody=true>
|
100
118
|
```
|
101
119
|
|
@@ -113,7 +131,7 @@ The Now API provides real-time concurrent information about your sites and apps,
|
|
113
131
|
_Now Example:_
|
114
132
|
|
115
133
|
```ruby
|
116
|
-
gs =
|
134
|
+
gs = Gosquared::RubyLibrary.new("your_API_key","your_project_token")
|
117
135
|
|
118
136
|
#instantiates new GoSquared object
|
119
137
|
|
@@ -134,7 +152,7 @@ The Trends API provides historical analytics information for any given period in
|
|
134
152
|
_Trends Example:_
|
135
153
|
|
136
154
|
```ruby
|
137
|
-
gs =
|
155
|
+
gs = Gosquared::RubyLibrary.new("your_API_key","your_project_token")
|
138
156
|
|
139
157
|
gs.trends.browser.from('2016-06-30').to('2016-07-07')
|
140
158
|
|
@@ -153,7 +171,7 @@ gs.trends.fetch
|
|
153
171
|
|
154
172
|
```ruby
|
155
173
|
|
156
|
-
gs =
|
174
|
+
gs = Gosquared::RubyLibrary.new("your_API_key","your_project_token")
|
157
175
|
|
158
176
|
gs.people.smartgroups
|
159
177
|
|
@@ -172,7 +190,7 @@ _Account Example:_
|
|
172
190
|
|
173
191
|
```ruby
|
174
192
|
|
175
|
-
gs =
|
193
|
+
gs = Gosquared::RubyLibrary.new("your_API_key","your_project_token")
|
176
194
|
|
177
195
|
gs.account.blocked.ips.ip('5.10.148.50')
|
178
196
|
|
@@ -182,7 +200,7 @@ gs.account.post
|
|
182
200
|
|
183
201
|
#posts the data to the 'GoSquared Account' endpoint
|
184
202
|
|
185
|
-
|
203
|
+
Response Message: OK
|
186
204
|
=> #<Net::HTTPOK 200 OK readbody=true>
|
187
205
|
|
188
206
|
gs.account.sites.token("your_site_token")
|
data/lib/config.rb
CHANGED
data/lib/gosquared.rb
CHANGED
@@ -5,14 +5,17 @@ require_relative "gosquared/people"
|
|
5
5
|
require_relative "gosquared/now"
|
6
6
|
require_relative "gosquared/account"
|
7
7
|
require_relative "config"
|
8
|
+
require_relative "compatibility"
|
8
9
|
|
9
|
-
module
|
10
|
+
module Gosquared
|
10
11
|
|
11
12
|
class RubyLibrary
|
12
13
|
|
13
14
|
def initialize api_key, site_id
|
14
15
|
@api_key = api_key
|
15
16
|
@site_id = site_id
|
17
|
+
raise 'api key cannot be empty/nil' if api_key.nil? || api_key.empty?
|
18
|
+
raise 'site_token cannot be empty/nil' if site_id.nil? || site_id.empty?
|
16
19
|
end
|
17
20
|
|
18
21
|
def trends
|
data/lib/gosquared/client.rb
CHANGED
@@ -39,7 +39,7 @@ class Client
|
|
39
39
|
response = false
|
40
40
|
end
|
41
41
|
end
|
42
|
-
puts "
|
42
|
+
puts "Response Message: #{response.message}" if response
|
43
43
|
response
|
44
44
|
end
|
45
45
|
|
@@ -61,7 +61,7 @@ def delete(url,data)
|
|
61
61
|
response = false
|
62
62
|
end
|
63
63
|
end
|
64
|
-
puts "
|
64
|
+
puts "Response Message: #{response.message}" if response
|
65
65
|
response
|
66
66
|
end
|
67
67
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails/generators/base'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Gosquared
|
4
4
|
module Generators
|
5
5
|
class ConfigGenerator < Rails::Generators::Base
|
6
6
|
source_root File.expand_path("../templates", __FILE__)
|
@@ -9,7 +9,7 @@ module GoSquared
|
|
9
9
|
|
10
10
|
def copy_initializer_file
|
11
11
|
@site_token = site_token
|
12
|
-
template("
|
12
|
+
template("gosquared.rb.erb", File.join("config/initializers/gosquared.rb"))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -15,7 +15,7 @@
|
|
15
15
|
arguments)};d=s.createElement(q);q=s.getElementsByTagName(q)[0];
|
16
16
|
d.src='//d1l6p2sc9645hc.cloudfront.net/tracker.js';q.parentNode.
|
17
17
|
insertBefore(d,q)}(window,document,'script','_gs');
|
18
|
-
_gs('#{
|
18
|
+
_gs('#{Gosquared.configure.site_token}'); _gs('set', 'trackLocal', true);
|
19
19
|
};
|
20
20
|
|
21
21
|
var loadTracker;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gosquared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Russell Vaughan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -50,6 +50,7 @@ files:
|
|
50
50
|
- Gemfile
|
51
51
|
- LICENSE
|
52
52
|
- README.md
|
53
|
+
- lib/compatibility.rb
|
53
54
|
- lib/config.rb
|
54
55
|
- lib/gosquared.rb
|
55
56
|
- lib/gosquared/account.rb
|
@@ -58,8 +59,8 @@ files:
|
|
58
59
|
- lib/gosquared/people.rb
|
59
60
|
- lib/gosquared/tracking.rb
|
60
61
|
- lib/gosquared/trends.rb
|
61
|
-
- lib/rails/generators/
|
62
|
-
- lib/rails/generators/
|
62
|
+
- lib/rails/generators/gosquared/config/config_generator.rb
|
63
|
+
- lib/rails/generators/gosquared/config/templates/gosquared.rb.erb
|
63
64
|
- lib/tracker_inject/injector.rb
|
64
65
|
- lib/tracker_inject/railtie.rb
|
65
66
|
- spec/account_spec.rb
|
@@ -89,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
90
|
version: '0'
|
90
91
|
requirements: []
|
91
92
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.4.8
|
93
94
|
signing_key:
|
94
95
|
specification_version: 4
|
95
96
|
summary: GoSquared Ruby Library
|