Skip to main content
Question

Browser SDK 2.0 track offline events


Hi. I used "@amplitude/analytics-browser": "^2.3.2" sdk and I face difficulties while working offline

I've tried default sending events without any manipulations and It is not working properly. Events not saving in localstorage. In localstorage created AMP_unsent_616a083d33 field with [] value 

Also tried to switch to batch API but when flushIntervalMillis expires — the request triggers and due to offline nothing happens, except deleting those events from local storage. 

I enabled debug logging and received this response:
 

Amplitude Logger [Debug]: {

  "type": "invoke public method",

  "name": "track",

  "args": [

    "pos_send_to_kitchen_kit_finished",

    {

      "transaction_date_start": 1697529188228,

      "kitchen_kit_platform_response": "no_response"

    }

  ],

  "stacktrace": [

    "at eval (webpack://poster/./js/pos/models/order/order.js?:4103:42)",

    "at _callee$ (webpack://poster/./js/pos/platform/platform.js?:351:19)",

    "at tryCatch (webpack://poster/./node_modules/regenerator-runtime/runtime.js?:63:40)",

    "at Generator.invoke [as _invoke] (webpack://poster/./node_modules/regenerator-runtime/runtime.js?:293:22)",

    "at Generator.eval [as next] (webpack://poster/./node_modules/regenerator-runtime/runtime.js?:118:21)",

    "at asyncGeneratorStep (webpack://poster/./js/pos/platform/platform.js?:81:103)",

    "at _next (webpack://poster/./js/pos/platform/platform.js?:83:194)",

    "at <anonymous>"

  ],

  "time": {

    "start": "2023-10-17T07:53:22.449Z",

    "end": "2023-10-17T07:53:52.441Z"

  },

  "states": {

    "before": {

      "config.apiKey": "config.apiKey",

      "timeline.queue.length": 0

    },

    "after": {

      "config.apiKey": "config.apiKey",

      "timeline.queue.length": 0

    }

  }

}

 

Help me discover how to work in offline please

 

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings