Comments (3)
@mijamo that's a fair question and suggestion. The purpose for returning this
for modification tasks is that it makes these methods chainable:
const cookie = Keen.utils.cookie('user_id')
.options({ ... })
.expire(14)
.set({
// ...
})
If you tack another .get('user_id')
after .set()
I think you would get the same result that you're looking for:
const userID = sessionCookie.get('user_id') || sessionCookie.set('user_id', Keen.helpers.getUniqueId()).get('user_id')
Would that do the trick?
from keen-tracking.js.
Yes this is what I ended up doing. I understood the chainable necessity for options
or expire
but a bit less for set
which in my mind was always at the end of the chain, but I also understand it may be useful in some cases.
from keen-tracking.js.
thanks @mijamo!
from keen-tracking.js.
Related Issues (20)
- respect navigator.donottrack HOT 1
- new defaults for v5
- autocollector - on click - add exact mouse/touch x, y values
- tracking of the form fields - bounce rates
- add more mobile device-related info to the events in Autocollector
- Client-side CORB Warning HOT 9
- Script throws an exception if localStorage is disabled HOT 2
- remove fetch polyfill HOT 2
- remove promise polyfill
- Cross Origin Read Blocked For Beacon API HOT 1
- send form fields on form submission
- Loading the tracker triggers a forced layout
- return responce.created
- Packaging Issue with 4.5.1 HOT 2
- Add way to define custom headers to extendEvents()
- Changelog is missing for 5.0 HOT 3
- Keen tracking on server side is not reusing connections
- serializeForm breaks form when submit is named HOT 4
- Is this project still maintained?
- Local community event tracker
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keen-tracking.js.