Skip to content

Commit

Permalink
Sessions (#16)
Browse files Browse the repository at this point in the history
* set the path for the cookie

* update hellotext_session to hello_session in README

* 1.8.1
  • Loading branch information
rockwellll authored Oct 23, 2024
1 parent ea5ce30 commit fe3dbea
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ Hellotext.removeEventListener(eventName, callback)

## Understanding Sessions

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.
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.
The session is automatically sent to Hellotext any time the `Hellotext.track` method is called.

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.
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.

### Get session

Expand Down
2 changes: 1 addition & 1 deletion dist/hellotext.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/models/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var Cookies = /*#__PURE__*/function () {
key: "set",
value: function set(name, value) {
if (typeof document !== 'undefined') {
document.cookie = "".concat(name, "=").concat(value);
document.cookie = "".concat(name, "=").concat(value, "; path=/;");
}
_hellotext.default.eventEmitter.dispatch('session-set', value);
return value;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hellotext/hellotext",
"version": "1.8.0",
"version": "1.8.1",
"description": "Hellotext JavaScript Client",
"source": "src/index.js",
"main": "lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/models/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Hellotext from '../hellotext'
class Cookies {
static set(name, value) {
if(typeof document !== 'undefined') {
document.cookie = `${name}=${value}`
document.cookie = `${name}=${value}; path=/;`
}

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

0 comments on commit fe3dbea

Please sign in to comment.