File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
src/codes/clj/docs/frontend/infra Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 1
1
(ns codes.clj.docs.frontend.infra.analytics
2
- (:require [codes.clj.docs.frontend.infra.system.state :as system.state]))
2
+ (:require [codes.clj.docs.frontend.infra.system.state :as system.state]
3
+ [clojure.string :as string]))
3
4
4
5
(defn google-tag-manager
5
6
[ga-tag-id]
20
21
gtag('config', '" ga-tag-id " ');" ))
21
22
(js/document.head.insertBefore script (.-nextSibling gtm-script))))
22
23
24
+ (defn ga-scripts
25
+ [ga-tag-id]
26
+ (when-not (string/blank? ga-tag-id)
27
+ (let [gtm-script (google-tag-manager ga-tag-id)]
28
+ (google-tag ga-tag-id gtm-script))))
29
+
23
30
(defn google-analytics []
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)))))
31
+ (ga-scripts (-> @system.state/components :config :ga-tag-id )))
You can’t perform that action at this time.
0 commit comments