Skip to content

Script v2: Sync event.props.path for special path-based events from event.pathname#5559

Merged
apata merged 12 commits intomasterfrom
script-v2/sync-event-props-path-for-special-goals-in-ingestion
Jul 14, 2025
Merged

Script v2: Sync event.props.path for special path-based events from event.pathname#5559
apata merged 12 commits intomasterfrom
script-v2/sync-event-props-path-for-special-goals-in-ingestion

Conversation

@apata
Copy link
Contributor

@apata apata commented Jul 8, 2025

Changes

If this PR is merged, then special path-based system goals (new term / module, name up for debate) won't need to have event.props.path defined during tracking requests.

These goals/events are "WP Form Completions", "Form: Submission", "404".

It will instead be set on receiving the event to be the same as event.pathname, unless event.props.path is explicitly defined.

We don't override it when it is explicitly defined to remain backwards compatible with users that are already sending these events with a particular value.

From our side, we can't distinguish intentional values and unintentional values for event.props.path, so the benefits of the sync will mostly apply to new customers, or customers that begin using these features after this PR is merged.

This approach stores the same pathname twice on our side for special path-based events, but the rate of these special events is many magnitudes less than rate of other events, so the duplicated data is insignificant in the grand scheme of things.

Todo after merge

Tests

  • Automated tests have been added

Changelog

  • Entry has been added to changelog

Documentation

  • Docs have been updated

Dark mode

  • This PR does not change the UI

@github-actions
Copy link

github-actions bot commented Jul 8, 2025

Analyzed 1026 tracker script variants for size changes.
The following tables summarize the results, with comparison with the baseline version in parentheses.

Main variants:

Brotli Gzip Uncompressed
npm_package/plausible.js (new variant) 2329B 2662B 6268B
plausible-web.js 2201B (-7B / -0.3%) 2495B (-15B / -0.6%) 5895B (-26B / -0.4%)

Important legacy variants:

Brotli Gzip Uncompressed
plausible.js 1155B (-3B / -0.3%) 1347B (-3B / -0.2%) 2944B (+0B / 0%)
plausible.hash.js 1121B (+0B / 0%) 1312B (-4B / -0.3%) 2830B (+0B / 0%)
plausible.pageview-props.tagged-events.js 1697B (+0B / 0%) 1970B (-4B / -0.2%) 4435B (+0B / 0%)
plausible.file-downloads.hash.pageview-props.revenue.js 1553B (+0B / 0%) 1829B (-4B / -0.2%) 3847B (+0B / 0%)
plausible.compat.exclusions.file-downloads.outbound-links.pageview-props.revenue.tagged-events.js 2286B (+0B / 0%) 2703B (-4B / -0.1%) 6042B (+0B / 0%)

Summary:

Brotli Gzip Uncompressed
Largest variant (plausible.compat.exclusions.file-downloads.outbound-links.pageview-props.revenue.tagged-events.js) 2286B (+0B / 0%) 2703B (-4B / -0.1%) 6042B (+0B / 0%)
Max change (plausible.compat.hash.revenue.js) 1156B (+8B / +0.7%) 1381B (-3B / -0.2%) 2946B (+0B / 0%)
Min change (plausible.compat.exclusions.local.manual.revenue.js) 1092B (-8B / -0.7%) 1325B (-4B / -0.3%) 2674B (+0B / 0%)
Median change 1645B (+0B / 0%) 1951B (-4B / -0.2%) 4198B (+0B / 0%)

In total, 114 variants brotli size increased and 147 variants brotli size decreased.

@apata apata added the tracker-release: patch Releases a new version of the tracker NPM package label Jul 8, 2025
@apata apata requested review from RobertJoonas and ukutaht July 8, 2025 13:35
Copy link
Contributor

@RobertJoonas RobertJoonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments inline, but other than that, I think this will get us to a good place! Nice job!

Copy link
Contributor

@RobertJoonas RobertJoonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat solution from this tricky situation. LGTM! 👍

@apata apata added this pull request to the merge queue Jul 14, 2025
Merged via the queue into master with commit 3bdbe83 Jul 14, 2025
10 checks passed
@apata apata deleted the script-v2/sync-event-props-path-for-special-goals-in-ingestion branch February 11, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tracker-release: patch Releases a new version of the tracker NPM package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants