Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support for invalid expression #58

Merged
merged 7 commits into from
Oct 7, 2024
Merged

Conversation

yuhao900914
Copy link
Contributor

This fixes the error that occurs when there is an invalid regular expression input from the GTM template. If it's invalid regular expression return ignore it and throw an error.

Also thought about other ways, but feel it will make things more complicated:

Checking the input in the template instead of the wrapper
a. The input is a string, and since Regex is not natively supported in the GTM template, we are unable to validate whether the input is a valid regular expression. The supported GTM template’s field validation only checks if an input matches a regular expression, but it does not validate the correctness of the regular expression itself.

Using an existing regular expression type in GTM
a. GTM has introduced a new variable, the regex table variable, which provides an output when an input matches a pattern. However, for referrerExclude, I don’t think this simplifies the implementation. Reference.

Handling this on the SDK side
a. The current SDK design allows either a string or a regular expression as input for the excludeReferrer. Unless we provide the input and the input type, we cannot check on SDK side.

@yuhao900914 yuhao900914 requested review from a team and izaaz October 2, 2024 22:58
src/amplitude-wrapper.js Outdated Show resolved Hide resolved
@yuhao900914 yuhao900914 force-pushed the v3.x-fix-invalid-expression branch from 5f8650e to efd4613 Compare October 3, 2024 06:39
@yuhao900914 yuhao900914 requested a review from izaaz October 3, 2024 06:40
@yuhao900914 yuhao900914 merged commit fb79072 into v3.x Oct 7, 2024
1 check passed
@yuhao900914 yuhao900914 deleted the v3.x-fix-invalid-expression branch October 7, 2024 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants