Skip to content

Commit 6e4fffb

Browse files
committed
Remove now superfluous props.path for '404' and 'WP Form Completions'
1 parent 2438940 commit 6e4fffb

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

assets/src/js/integrations/form-submit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ document.addEventListener('DOMContentLoaded', () => {
3333
* Send a custom event to Plausible.
3434
*/
3535
trackSubmission: function () {
36-
plausible(plausible_analytics_i18n.form_completions, {'props': {'path': document.location.pathname}});
36+
plausible(plausible_analytics_i18n.form_completions);
3737
}
3838
};
3939

assets/src/js/integrations/form-submit.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Actions.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,9 @@ public function maybe_register_assets() {
7171

7272
// Track 404 pages (if enabled)
7373
if ( Helpers::is_enhanced_measurement_enabled( '404' ) && is_404() ) {
74-
$data = wp_json_encode(
75-
[
76-
'props' => [
77-
'path' => 'document.location.pathname',
78-
],
79-
]
80-
);
81-
82-
/**
83-
* document.location.pathname is a variable. @see wp_json_encode() doesn't allow passing variable, only strings. This fixes that.
84-
*/
85-
$data = str_replace( '"document.location.pathname"', 'document.location.pathname', $data );
86-
8774
wp_add_inline_script(
8875
'plausible-analytics',
89-
"document.addEventListener('DOMContentLoaded', function () { plausible( '404', $data ); });"
76+
"document.addEventListener('DOMContentLoaded', function () { plausible( '404' ) });"
9077
);
9178
}
9279

0 commit comments

Comments
 (0)