mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-21 01:19:58 +01:00
Add initial support for Google Analytics
This commit is contained in:
parent
dd91f983b5
commit
1cc03fdd8c
7 changed files with 31 additions and 0 deletions
|
|
@ -33,6 +33,7 @@ func ServeIndex(ds model.DataStore, fs http.FileSystem) http.HandlerFunc {
|
|||
"loginBackgroundURL": policy.Sanitize(conf.Server.UILoginBackgroundURL),
|
||||
"welcomeMessage": policy.Sanitize(conf.Server.UIWelcomeMessage),
|
||||
"enableTranscodingConfig": conf.Server.EnableTranscodingConfig,
|
||||
"gaTrackingId": conf.Server.GATrackingID,
|
||||
}
|
||||
j, err := json.Marshal(appConfig)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -103,6 +103,17 @@ var _ = Describe("ServeIndex", func() {
|
|||
Expect(config).To(HaveKeyWithValue("enableTranscodingConfig", true))
|
||||
})
|
||||
|
||||
It("sets the gaTrackingId", func() {
|
||||
conf.Server.GATrackingID = "UA-12345"
|
||||
r := httptest.NewRequest("GET", "/index.html", nil)
|
||||
w := httptest.NewRecorder()
|
||||
|
||||
ServeIndex(ds, fs)(w, r)
|
||||
|
||||
config := extractAppConfig(w.Body.String())
|
||||
Expect(config).To(HaveKeyWithValue("gaTrackingId", "UA-12345"))
|
||||
})
|
||||
|
||||
It("sets the version", func() {
|
||||
r := httptest.NewRequest("GET", "/index.html", nil)
|
||||
w := httptest.NewRecorder()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue