Skip to content

Commit 47b3183

Browse files
committed
change the use of deprecated piwik.siteName to piwik.currentSiteName; also cleaned up code a bit
1 parent 2221a0e commit 47b3183

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

plugins/CoreHome/vue/src/Matomo/Matomo.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ function getReportingMenuStore() {
2323
}
2424

2525
function getComparisonsStore(): ComparisonsStoreLike|undefined {
26-
// const coreHome = (window as unknown as
27-
// { CoreHome?: { ComparisonsStoreInstance?: ComparisonsStoreLike } }).CoreHome;
28-
// return coreHome?.ComparisonsStoreInstance;
2926
return window.CoreHome.ComparisonsStoreInstance;
3027
}
3128

@@ -71,9 +68,9 @@ piwik.updateDateInTitle = function updateDateInTitle(date: string, period: strin
7168

7269
// Cache server-rendered page title
7370
originalTitle = originalTitle || document.title;
74-
if (originalTitle.indexOf(piwik.siteName) === 0) {
71+
if (originalTitle.indexOf(piwik.currentSiteName) === 0) {
7572
const dateString = ` - ${Periods.parse(period, date).getPrettyString()} `;
76-
document.title = `${piwik.siteName}${dateString}${originalTitle.slice(piwik.siteName.length)}`;
73+
document.title = `${piwik.currentSiteName}${dateString}${originalTitle.slice(piwik.currentSiteName.length)}`;
7774
}
7875
};
7976

@@ -99,7 +96,7 @@ piwik.updateTitle = function updateTitle(
9996

10097
// Cache server-rendered page title
10198
originalTitle = originalTitle || document.title;
102-
if (originalTitle.indexOf(piwik.siteName) === 0) {
99+
if (originalTitle.indexOf(piwik.currentSiteName) === 0) {
103100
const dateString = ` - ${Periods.parse(period, date).getPrettyString()} `;
104101
// Try to get the correct title by combining the category and subcategory names
105102
const titlePath = [categoryName, subcategoryName]
@@ -109,8 +106,8 @@ piwik.updateTitle = function updateTitle(
109106
const categorySubcategoryString = titlePath.length ? ` - ${titlePath.join(' > ')}` : '';
110107
const segmentLabel = getActiveSegmentLabel(segment);
111108
const segmentString = segmentLabel ? ` - ${piwikHelper.htmlEntities(segmentLabel)}` : '';
112-
document.title = `${piwik.siteName}${dateString}${categorySubcategoryString}${segmentString}${originalTitle.slice(
113-
piwik.siteName.length,
109+
document.title = `${piwik.currentSiteName}${dateString}${categorySubcategoryString}${segmentString}${originalTitle.slice(
110+
piwik.currentSiteName.length,
114111
)}`;
115112
}
116113
};

0 commit comments

Comments
 (0)