diff --git a/common/changes/@snowplow/browser-tracker-core/marcin-j-master_2024-06-18-05-25.json b/common/changes/@snowplow/browser-tracker-core/marcin-j-master_2024-06-18-05-25.json new file mode 100644 index 000000000..e88cb3be9 --- /dev/null +++ b/common/changes/@snowplow/browser-tracker-core/marcin-j-master_2024-06-18-05-25.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@snowplow/browser-tracker-core", + "comment": "Fix custom document title override using setDocumentTitle (#1317)", + "type": "none" + } + ], + "packageName": "@snowplow/browser-tracker-core" + } diff --git a/libraries/browser-tracker-core/src/tracker/index.ts b/libraries/browser-tracker-core/src/tracker/index.ts index 37e504fa2..20356403d 100755 --- a/libraries/browser-tracker-core/src/tracker/index.ts +++ b/libraries/browser-tracker-core/src/tracker/index.ts @@ -951,7 +951,7 @@ export function Tracker( // So we know what document.title was at the time of trackPageView lastDocumentTitle = document.title; - lastConfigTitle = title; + lastConfigTitle = title ?? lastConfigTitle; // Fixup page title const pageTitle = fixupTitle(lastConfigTitle || lastDocumentTitle);