mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-18 12:14:41 -05:00
Feature - Added Optional Google Analytics tag for Status Page.
This commit is contained in:
parent
d0ac3fc207
commit
29e24e0de9
4
db/patch-add-google-analytics-status-page-tag.sql
Normal file
4
db/patch-add-google-analytics-status-page-tag.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
-- You should not modify if this have pushed to Github, unless it does serious wrong with the db.
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
ALTER TABLE status_page ADD google_analytics_tag_id TEXT;
|
||||||
|
COMMIT;
|
@ -69,6 +69,7 @@ class Database {
|
|||||||
"patch-ping-packet-size.sql": true,
|
"patch-ping-packet-size.sql": true,
|
||||||
"patch-maintenance-table2.sql": true,
|
"patch-maintenance-table2.sql": true,
|
||||||
"patch-add-gamedig-monitor.sql": true,
|
"patch-add-gamedig-monitor.sql": true,
|
||||||
|
"patch-add-google-analytics-status-page-tag.sql": true
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -225,6 +225,7 @@ class StatusPage extends BeanModel {
|
|||||||
customCSS: this.custom_css,
|
customCSS: this.custom_css,
|
||||||
footerText: this.footer_text,
|
footerText: this.footer_text,
|
||||||
showPoweredBy: !!this.show_powered_by,
|
showPoweredBy: !!this.show_powered_by,
|
||||||
|
googleAnalyticsId: this.google_analytics_tag_id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,6 +246,7 @@ class StatusPage extends BeanModel {
|
|||||||
customCSS: this.custom_css,
|
customCSS: this.custom_css,
|
||||||
footerText: this.footer_text,
|
footerText: this.footer_text,
|
||||||
showPoweredBy: !!this.show_powered_by,
|
showPoweredBy: !!this.show_powered_by,
|
||||||
|
googleAnalyticsId: this.google_analytics_tag_id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,6 +163,7 @@ module.exports.statusPageSocketHandler = (socket) => {
|
|||||||
statusPage.custom_css = config.customCSS;
|
statusPage.custom_css = config.customCSS;
|
||||||
statusPage.show_powered_by = config.showPoweredBy;
|
statusPage.show_powered_by = config.showPoweredBy;
|
||||||
statusPage.modified_date = R.isoDateTime();
|
statusPage.modified_date = R.isoDateTime();
|
||||||
|
statusPage.google_analytics_tag_id = config.googleAnalyticsId;
|
||||||
|
|
||||||
await R.store(statusPage);
|
await R.store(statusPage);
|
||||||
|
|
||||||
|
@ -64,6 +64,12 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Google Analytics -->
|
||||||
|
<div class="my-3">
|
||||||
|
<label for="googleAnalyticsTag" class="form-label">{{ $t("Google Analytics ID") }}</label>
|
||||||
|
<input id="googleAnalyticsTag" v-model="config.googleAnalyticsId" type="text" class="form-control">
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Custom CSS -->
|
<!-- Custom CSS -->
|
||||||
<div class="my-3">
|
<div class="my-3">
|
||||||
<div class="mb-1">{{ $t("Custom CSS") }}</div>
|
<div class="mb-1">{{ $t("Custom CSS") }}</div>
|
||||||
@ -294,6 +300,15 @@
|
|||||||
<component is="style" v-if="config.customCSS" type="text/css">
|
<component is="style" v-if="config.customCSS" type="text/css">
|
||||||
{{ config.customCSS }}
|
{{ config.customCSS }}
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
|
<component :is="'script'" v-if="config.googleAnalyticsId" async :src="'https://www.googletagmanager.com/gtag/js?id=' + config.googleAnalyticsId" />
|
||||||
|
|
||||||
|
<component :is="'script'" v-if="config.googleAnalyticsId">
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag(){dataLayer.push(arguments);}
|
||||||
|
gtag('js', new Date());
|
||||||
|
gtag('config', '{{ config.googleAnalyticsId }}');
|
||||||
|
</component>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user