snowplow / snowplow-javascript-tracker

Snowplow event tracker for client-side and server-side JavaScript. Add analytics to your websites, web apps and servers.
http://snowplowanalytics.com
BSD 3-Clause "New" or "Revised" License
555 stars 222 forks source link

Add browser-tracker-core default for os_timezone #1338

Closed jethron closed 2 months ago

jethron commented 3 months ago

This adds a more lightweight way for the browser-tracker to get a value for the os_timezone/tz field that doesn't rely on the usual Timezone plugin.

The Timezone plugin is very data-heavy, and when minified is currently the 4th largest plugin we distribute, but populates only this single field:

$ ls -nSh ./*/dist/index.umd.min.js
-rw-r--r-- 1 1000 1004  48K Jul 24 19:00 ./browser-plugin-vimeo-tracking/dist/index.umd.min.js
-rw-r--r-- 1 1000 1004  20K Jul 24 19:00 ./browser-plugin-media/dist/index.umd.min.js
-rw-r--r-- 1 1000 1004  13K Jul 24 18:59 ./browser-plugin-snowplow-ecommerce/dist/index.umd.min.js
-rw-r--r-- 1 1000 1004  13K Jul 24 18:59 ./browser-plugin-timezone/dist/index.umd.min.js
-rw-r--r-- 1 1000 1004  11K Jul 24 18:59 ./browser-plugin-youtube-tracking/dist/index.umd.min.js
-rw-r--r-- 1 1000 1004  11K Jul 24 19:00 ./browser-plugin-media-tracking/dist/index.umd.min.js
-rw-r--r-- 1 1000 1004 9.3K Jul 24 19:01 ./browser-plugin-debugger/dist/index.umd.min.js
-rw-r--r-- 1 1000 1004 6.3K Jul 24 19:00 ./browser-plugin-form-tracking/dist/index.umd.min.js
-rw-r--r-- 1 1000 1004 5.9K Jul 24 19:00 ./browser-plugin-link-click-tracking/dist/index.umd.min.js
-rw-r--r-- 1 1000 1004 4.9K Jul 24 19:00 ./browser-plugin-enhanced-ecommerce/dist/index.umd.min.js

That plugin is no longer included by default in the sp.js build, and from my observations, rarely used when people use the browser-tracker directly, likely due to its size.

I think this value is valuable to have as a datapoint, because it enables using the derived_tstamp to actually measure the "time of day" a user is on a site without having to guess based on the region determined via GeoIP. This adds a default to the tracker that should provide a good estimate for this value even without the use of the Timezone plugin, based on the configured timezone information available via the Internationalization API. If the Timezone plugin is in use, it will override the value with whatever it determines.

bundlemon[bot] commented 3 months ago

BundleMon

Files added (6) Status | Path | Size | Limits :------------: | ------------ | :------------: | :------------: :white_check_mark: | trackers/javascript-tracker/dist/sp.js
| +27.72KB | 30KB / +10% :white_check_mark: | libraries/browser-tracker-core/dist/index.mod
ule.js
| +22.49KB | 25KB / +10% :white_check_mark: | libraries/tracker-core/dist/index.module.js
| +19.12KB | 20KB / +10% :white_check_mark: | trackers/javascript-tracker/dist/sp.lite.js
| +16.88KB | 20KB / +10% :white_check_mark: | trackers/browser-tracker/dist/index.umd.min.j
s
| +16.87KB | 20KB / +10% :white_check_mark: | trackers/browser-tracker/dist/index.module.js
| +3.49KB | 5KB / +10%

Total files change +106.57KB 0%

Final result: :white_check_mark:

View report in BundleMon website ➡️


Current branch size history