File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed
src/codes/clj/docs/frontend Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 17
17
:closure-defines {codes.clj.docs.frontend.config/BASE_URL #shadow/env [" BASE_URL" ]
18
18
codes.clj.docs.frontend.config/CLIENT_ID #shadow/env [" CLIENT_ID" ]
19
19
codes.clj.docs.frontend.config/REDIRECT_URI #shadow/env [" REDIRECT_URI" ]
20
- codes.clj.docs.frontend.infra.analytics /GA_TAG_ID #shadow/env [" GA_TAG_ID" ]}}
20
+ codes.clj.docs.frontend.config /GA_TAG_ID #shadow/env [" GA_TAG_ID" ]}}
21
21
:build-hooks [(codes.clj.docs.frontend.dev.shadow.hooks/hashed-files
22
22
[" resources/public/css/app.css"
23
23
" resources/public/js/core.js" ])
Original file line number Diff line number Diff line change 20
20
(goog-define BASE_URL " https://docs-backend.fly.dev/api/" )
21
21
(goog-define CLIENT_ID " 46d86692f00ed9c613a1" )
22
22
(goog-define REDIRECT_URI " https://docs.clj.codes/github-callback" )
23
+ (goog-define GA_TAG_ID " " )
23
24
24
25
(def config
25
26
(let [debug? goog.DEBUG]
26
27
{:debug? debug?
28
+ :ga-tag-id (if debug?
29
+ " "
30
+ GA_TAG_ID)
27
31
:base-url (if debug?
28
32
" http://localhost:3001/api/"
29
33
BASE_URL)
Original file line number Diff line number Diff line change 1
- (ns codes.clj.docs.frontend.infra.analytics )
2
-
3
- (goog-define GA_TAG_ID " G-0123456789" )
1
+ (ns codes.clj.docs.frontend.infra.analytics
2
+ (:require [codes.clj.docs.frontend.infra.system.state :as system.state]))
4
3
5
4
(defn google-tag-manager
6
5
[ga-tag-id]
22
21
(js/document.head.insertBefore script (.-nextSibling gtm-script))))
23
22
24
23
(defn google-analytics []
25
- (let [gtm-script (google-tag-manager GA_TAG_ID)]
26
- (google-tag GA_TAG_ID gtm-script)))
24
+ (let [ga-tag-id (-> @system.state/components :config :ga-tag-id )]
25
+ (when (seq ga-tag-id)
26
+ (let [gtm-script (google-tag-manager ga-tag-id)]
27
+ (google-tag ga-tag-id gtm-script)))))
You can’t perform that action at this time.
0 commit comments