README: fix typos in documentation for setTransport #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We're using the Amplitude GTM template and are trying to "Set the transport to use beacon only when exiting the page".
The code sample from the Browser 2.0 SDK docs is as follows:
The readme for the
amplitude-js-gtm
library loaded/used by the GTM template shows the following docs for usingsetTransport
via the GTM wrapper: https://www.npmjs.com/package/@amplitude/amplitude-js-gtm#settransportLooking at the underlying source repos, it seems there may be two typos here:
setTransportType
is not in the enum of available events (it appears it should besetTransport
instead)browser-client
'ssetTransport
method expects an argument of type TransportType, which usesbeacon
(notsendBeacon
):This PR updates the docs to reflect the above, but it's entirely possible I'm just not following the source packages correctly...so please let me know if I'm entirely missing things! 🙈
Separately (and not implemented in this PR): would it be worth making the early return in the command wrapper throw an error or log when an unrecognized command is provided instead of silently ignoring it? https://github.com/amplitude/amplitude-js-gtm/blob/v3.x/src/amplitude-wrapper.js#L193