Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto tracking's local_time_full is incorrectly using UTC time #162

Open
todda00 opened this issue Feb 21, 2019 · 2 comments
Open

Auto tracking's local_time_full is incorrectly using UTC time #162

todda00 opened this issue Feb 21, 2019 · 2 comments

Comments

@todda00
Copy link

todda00 commented Feb 21, 2019

The auto tracking fills both keen.timestamp keen.local_time_full with the same, UTC value by using
new Date().toISOString() which always produces a UTC time.

https://github.com/keen/keen-tracking.js/blob/master/lib/browser-auto-tracking.js#L122

It appears that the local_time_full is redundant since its storing the same UTC time as the keen.timestamp. Not sure if this is an error, or if there is some other reason unbeknownst to me why this property exists.

I'm setting up our initial event tracking now and want to follow best practices. While we aren't directly using the auto tracking, I am using it as a model for our events. Generally is it best practice to track and rely on UTC time for events? I would suspect so, but wanted to bring what I found to your attention.

@adamkasprowicz
Copy link
Contributor

Hi @todda00
Thank you for feedback! You're right - the local_time_full property is deprecated, because the same UTC value is duplicated inside the keen.timestamp. We'll remove it in the next major version to avoid any confusion in the future.

You can rely on the datetime-parser to handle timezone differences
https://keen.io/docs/api/?#datetime-parser
https://github.com/keen/keen-tracking.js/blob/master/lib/browser-auto-tracking.js#L92

Even if keen.timestamp is UTC, you can use a different timezone when you call the API to get the results.

@todda00
Copy link
Author

todda00 commented Feb 22, 2019

Perfect, thanks for the info! I have removed the local_time_full property from my usage. Good to know I'm on the right path.

Loving Keen so far, Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants