-
Notifications
You must be signed in to change notification settings - Fork 70
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
feat(page-meta): provide options to override automatically created pageId's #923
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
codecapitano
changed the title
707 create api to set page
feat(page-meta): provide options to override automatically created pageId's
Jan 29, 2025
codecapitano
force-pushed
the
707-create-api-to-set-page_id
branch
from
January 29, 2025 15:28
e5986bd
to
dbcbf0f
Compare
eskirk
reviewed
Jan 30, 2025
eskirk
approved these changes
Jan 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, one comment about a potential solution to your testing issue
cedricziel
approved these changes
Jan 30, 2025
The desired API usage would be: Ad hoc usage: faro.api.setPage('product-list'); Init usage: initializeFaro({
page: {
id: 'product-list'
}
}); |
cedricziel
reviewed
Jan 30, 2025
cedricziel
approved these changes
Jan 30, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
With this PR we provide a convenient way to the user to change the page-meta.
This is mostly useful to give users and option to provide a custom template for pageID parsing.
If the page-meta contains an
id
attribute, the Faro receiver will use this ID instead.API
Page tracking can be configured during initialisation via the Faro options
page
property can be used to set the initial page-meta.generatePageId()
function is used to define a template parsers which consistently updates the page id. It is to satisfy advanced use cases** Explicitly set a the page via the
setPage(page: string)
function.setPage
is an overloaded function. If thepage
parameter is of type string, Faro updates the current active page meta with the given page id.What
setPage(meta)
function to set/override the page-meta andgetPage()
function to receiver it.defaultMetas
object is removed and such not exported anymore because pageMeta creation changed. This can break if users used that export for some reasons. It was never meant to be used outside Faro so we decided to remove it anyways.Links
Screenshots
Manually testing the pageId parser using a custom parser which attaches a random id to the pageId URL string.
Jest doesn't play well with manually changing the URLs.
Location isn't updated on the code side
Screen.Recording.2025-01-29.at.13.39.37.mov
Checklist