mirror of
https://github.com/HangarMC/Hangar.git
synced 2025-01-18 14:14:50 +08:00
make GA code configurable
Signed-off-by: MiniDigger <admin@minidigger.me>
This commit is contained in:
parent
08918b4c07
commit
43db10ca57
@ -30,6 +30,7 @@ public class HangarConfig {
|
||||
private final ApplicationHome home = new ApplicationHome(HangarApplication.class);
|
||||
private String pluginUploadDir = home.getDir().toPath().resolve("work").toString();
|
||||
private String baseUrl = "https://localhost:8080";
|
||||
private String gaCode = "";
|
||||
|
||||
@NestedConfigurationProperty
|
||||
public final FakeUserConfig fakeUser;
|
||||
@ -191,6 +192,14 @@ public class HangarConfig {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public String getGaCode() {
|
||||
return gaCode;
|
||||
}
|
||||
|
||||
public void setGaCode(String gaCode) {
|
||||
this.gaCode = gaCode;
|
||||
}
|
||||
|
||||
public void checkDebug() {
|
||||
if (!debug) {
|
||||
throw new UnsupportedOperationException("this function is supported in debug mode only");
|
||||
|
@ -49,6 +49,7 @@ hangar:
|
||||
auth-url: "http://localhost:8000"
|
||||
base-url: "http://localhost:8080"
|
||||
use-webpack: true
|
||||
ga-code: "UA-38006759-9"
|
||||
|
||||
sponsors:
|
||||
- name: Beer
|
||||
|
@ -51,13 +51,13 @@ showFooter: Boolean = true, noContainer: Boolean = false, additionalMeta: Html =
|
||||
<meta name="theme-color" content="#2980B9">
|
||||
|
||||
<#-- google foo -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-38006759-9"></script>
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=${config.gaCode}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'UA-38006759-9');
|
||||
gtag('config', '${config.gaCode}');
|
||||
</script>
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user