-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Labels
bugSomething isn't workingSomething isn't workingopen sourcePRs or issues originating from the open-source communityPRs or issues originating from the open-source community
Description
Describe the bug
I'm currently working in legacy code that uses the RudderStack SDK version 1.33.0
. For technical reasons, we need to use a workaround involving window.location.replace
. Before we replace
the URL, we'd like to track an event.
When calling replace
in track
's callback, it seems that:
- The callback runs immediately.
- The network request starts, but it is cancelled.
- The event isn't logged.
I understand we're using a very outdated version of the SDK. I'm wondering:
- Was this behaviour changed/fixed in a later version of the SDK?
- We'd like to avoid breaking changes and a major version upgrade, if at all possible. Could this be fixed for
1.x
at all?
To Reproduce
- Open browser console and ensure logs are preserved for both the Network tab and Console tab.
- Use the following snippet to simulate the issue:
window.rudderanalytics.track("some_event", () => {
window.location.replace("https://example.com");
});
- Observe the network request is cancelled:

Expected behavior
- The callback executes only after the request has completed.
- Not a requirement, but it makes sense to me that the callback should be given an argument indicating success of failure (and/or, ideally the response itself). From what I can tell, the callback doesn't receive any args.
The v1.1 documentation for this function states (emphasis mine):
Called after the successful execution of the track call.
Additional Information (please complete the following information):
- SDK installation type: CDN (unsure)
- SDK version: 1.33.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingopen sourcePRs or issues originating from the open-source communityPRs or issues originating from the open-source community