File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export default function Matomo() {
44
44
const normalizedPreviousPath = normalizePathForMatomo ( previousPath )
45
45
const normalizedPathname = normalizePathForMatomo ( pathname )
46
46
47
- push ( [ "setReferrerUrl" , ` ${ normalizedPreviousPath } ` ] )
47
+ push ( [ "setReferrerUrl" , normalizedPreviousPath ] )
48
48
push ( [ "setCustomUrl" , normalizedPathname ] )
49
49
push ( [ "deleteCustomVariables" , "page" ] )
50
50
setPreviousPath ( pathname )
Original file line number Diff line number Diff line change @@ -12,17 +12,16 @@ export const MATOMO_LS_KEY = "ethereum-org.matomo-opt-out"
12
12
* but we want to track them as /en paths for analytics consistency.
13
13
*/
14
14
export const normalizePathForMatomo = ( pathname : string ) : string => {
15
- // If already has a locale prefix (like /es/, /fr/), keep it as is
16
- const hasLocalePrefix = LOCALES_CODES . some (
17
- ( locale ) => locale !== DEFAULT_LOCALE && pathname . startsWith ( `/${ locale } /` )
15
+ const hasLocalePrefix = LOCALES_CODES . some ( ( locale ) =>
16
+ pathname . startsWith ( `/${ locale } /` )
18
17
)
19
18
20
19
if ( hasLocalePrefix ) {
21
20
return pathname
22
21
}
23
22
24
23
// For paths without locale prefix (English content), add /en prefix
25
- return pathname === "/" ? "/en" : `/en ${ pathname } `
24
+ return `/ ${ DEFAULT_LOCALE } ${ pathname } `
26
25
}
27
26
28
27
export interface MatomoEventOptions {
You can’t perform that action at this time.
0 commit comments