Skip to content

Commit fe3dbea

Browse files
authored
Sessions (#16)
* set the path for the cookie * update hellotext_session to hello_session in README * 1.8.1
1 parent ea5ce30 commit fe3dbea

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ Hellotext.removeEventListener(eventName, callback)
7878

7979
## Understanding Sessions
8080

81-
The library looks for a session identifier present on the `hellotext_session` query parameter. If the session is not present as a cookie neither it will create a new random session identifier, you can disable this default behaviour via the configuration, see [Configuration Options](#configuration-options) for more information.
81+
The library looks for a session identifier present on the `hello_session` query parameter. If the session is not present as a cookie neither it will create a new random session identifier, you can disable this default behaviour via the configuration, see [Configuration Options](#configuration-options) for more information.
8282
The session is automatically sent to Hellotext any time the `Hellotext.track` method is called.
8383

84-
Short links redirections attaches a session identifier to the destination url as `hellotext_session` query parameter. This will identify all the events back to the customer who opened the link.
84+
Short links redirections attaches a session identifier to the destination url as `hello_session` query parameter. This will identify all the events back to the customer who opened the link.
8585

8686
### Get session
8787

dist/hellotext.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/models/cookies.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var Cookies = /*#__PURE__*/function () {
1919
key: "set",
2020
value: function set(name, value) {
2121
if (typeof document !== 'undefined') {
22-
document.cookie = "".concat(name, "=").concat(value);
22+
document.cookie = "".concat(name, "=").concat(value, "; path=/;");
2323
}
2424
_hellotext.default.eventEmitter.dispatch('session-set', value);
2525
return value;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hellotext/hellotext",
3-
"version": "1.8.0",
3+
"version": "1.8.1",
44
"description": "Hellotext JavaScript Client",
55
"source": "src/index.js",
66
"main": "lib/index.js",

src/models/cookies.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Hellotext from '../hellotext'
33
class Cookies {
44
static set(name, value) {
55
if(typeof document !== 'undefined') {
6-
document.cookie = `${name}=${value}`
6+
document.cookie = `${name}=${value}; path=/;`
77
}
88

99
Hellotext.eventEmitter.dispatch('session-set', value)

0 commit comments

Comments
 (0)