ahoy_matey 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +14 -12
- data/lib/ahoy.rb +2 -0
- data/lib/ahoy/controller.rb +8 -1
- data/lib/ahoy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9db513e48eea03c383990fb228564e252bebc5b
|
4
|
+
data.tar.gz: a05f03369e5777866a376d0e9c62989f74dfb4c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cc1490028f6f3ab3565b8214ab67b29b35d50feed74c7a2ba171de1a5c765d5be3a1c1708fa14db440a350a429fa49b18e63119b4d3a6472866cadfc02e6eda
|
7
|
+
data.tar.gz: 693ce18cd49030035611bea317a931011c9d2ffd01c2ef5d77769b040bc88a1ebe06364ed2b864a21513c276aa2db8dad95e1e27d2d610c7ae44c3138d02e9eb
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -142,18 +142,12 @@ When a user launches the app, create a visit. Send a `POST` request to `/ahoy/v
|
|
142
142
|
- platform - `iOS`, `Android`, etc.
|
143
143
|
- app_version - `1.0.0`
|
144
144
|
- os_version - `7.0.6`
|
145
|
-
-
|
145
|
+
- visit_token - `505f6201-8e10-44cf-ba1c-37271c8d0125`
|
146
|
+
- visitor_token - `db3b1a8f-302b-42df-9cd0-06875f549474`
|
146
147
|
|
147
|
-
|
148
|
+
Tokens must be [UUIDs](http://en.wikipedia.org/wiki/Universally_unique_identifier).
|
148
149
|
|
149
|
-
|
150
|
-
{
|
151
|
-
"visit_token": "8tx2ziymkwa1WlppnkqxyaBaRlXrEQ3K",
|
152
|
-
"visitor_token": "hYBIV0rBfrIUAiArWweiECt4N9pyiygN"
|
153
|
-
}
|
154
|
-
```
|
155
|
-
|
156
|
-
Send the visit token in the `Ahoy-Visit` header for all requests.
|
150
|
+
Send the visit and visitor tokens in the `Ahoy-Visit` and `Ahoy-Visitor` headers with all requests.
|
157
151
|
|
158
152
|
After 4 hours, create another visit and use the updated visit token.
|
159
153
|
|
@@ -256,7 +250,7 @@ Turn off logging
|
|
256
250
|
ahoy.debug(false);
|
257
251
|
```
|
258
252
|
|
259
|
-
Debug endpoint requests in Ruby
|
253
|
+
Debug endpoint requests in Ruby
|
260
254
|
|
261
255
|
```ruby
|
262
256
|
Ahoy.quiet = false
|
@@ -287,7 +281,15 @@ end
|
|
287
281
|
|
288
282
|
## Reference
|
289
283
|
|
290
|
-
To track visits across multiple subdomains,
|
284
|
+
To track visits across multiple subdomains, you must set the domain in two places (at the moment).
|
285
|
+
|
286
|
+
Add this to the `config/initializers/ahoy.rb` initializer:
|
287
|
+
|
288
|
+
```ruby
|
289
|
+
Ahoy.domain = "yourdomain.com"
|
290
|
+
```
|
291
|
+
|
292
|
+
and add this **before** the javascript files:
|
291
293
|
|
292
294
|
```javascript
|
293
295
|
var ahoy = {"domain": "yourdomain.com"};
|
data/lib/ahoy.rb
CHANGED
data/lib/ahoy/controller.rb
CHANGED
@@ -30,7 +30,14 @@ module Ahoy
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def set_ahoy_visitor_cookie
|
33
|
-
|
33
|
+
if !request.headers["Ahoy-Visitor"] && !cookies[:ahoy_visitor]
|
34
|
+
cookie = {
|
35
|
+
value: current_visitor_token,
|
36
|
+
expires: 2.years.from_now
|
37
|
+
}
|
38
|
+
cookie[:domain] = Ahoy.domain if Ahoy.domain
|
39
|
+
cookies[:ahoy_visitor] = cookie
|
40
|
+
end
|
34
41
|
end
|
35
42
|
|
36
43
|
end
|
data/lib/ahoy/version.rb
CHANGED