DavidWells / analytics

Lightweight analytics abstraction layer for tracking page views, custom events, & identifying visitors
https://getanalytics.io
MIT License
2.38k stars 240 forks source link

fix: crash in analytics.reset for aws pinpoint #397

Open renzil opened 10 months ago

renzil commented 10 months ago

Title: Calling analytics.reset leads to a crash on analytics-plugin-aws-pinpoint in the browser Browser: Chrome Version 115.0.5790.114 (Official Build) (x86_64) OS: OSX 12.6.5

Steps to reproduce:

  1. Setup a vanilla HTML in browser implementation of analytics and analytics-plugin-aws-pinpoint
  2. Call analytics.reset

Result: Crash with the following stacktrace

storage is not defined ReferenceError: storage is not defined at Object.reset (https://my.bundle.min.js:2099:7) at https://my.bundle.min.js:2196:9319

Analysis: The storage object is not defined but is being used to delete a key in the reset callback of the pinpoint plugin. I have just directly used the removeItem import and I am getting results as expected. Please verify if this is the correct fix @DavidWells