Make analytics and DNT detection work

This commit is contained in:
Jeremy Dormitzer 2018-01-31 22:45:44 -07:00
parent 419aa55f14
commit 647b0e216a
No known key found for this signature in database
GPG Key ID: 04F17C0F5A32C320
3 changed files with 19 additions and 17 deletions

View File

@ -31,6 +31,6 @@
}
],
"permissions": ["tabs", "https://hn.algolia.com/*"],
"content_security_policy": "script-src 'self' 'unsafe-eval' 'sha256-CfMPE8ys/ylJ5D9qKG0a9/UejrcczMr4/EmFCbVbgcc=' 'sha256-XsBu2nEJnS7x/Izq1v7dzy3Ze5myJMHvg4zukh/R1Yk=' 'sha256-AUCho1UyOpYFSZDg8EM9SYlysRIrUpQKZ7iE9CFSYfU=' 'sha256-vLlTaRFN8A2FPadIx711FwK9Ytd6LXkAzuEYAdC0D1k='; object-src 'self'; connect-src 'self' https://hn.algolia.com",
"content_security_policy": "script-src 'self' 'unsafe-eval' 'sha256-CfMPE8ys/ylJ5D9qKG0a9/UejrcczMr4/EmFCbVbgcc=' 'sha256-XsBu2nEJnS7x/Izq1v7dzy3Ze5myJMHvg4zukh/R1Yk=' 'sha256-AUCho1UyOpYFSZDg8EM9SYlysRIrUpQKZ7iE9CFSYfU=' 'sha256-vLlTaRFN8A2FPadIx711FwK9Ytd6LXkAzuEYAdC0D1k=' 'sha256-uM0I4me9aSUPORchT/KpGrvBQV6915H0JG2FGR5+BOs=' https://cdn.amplitude.com; object-src 'self'; connect-src 'self' https://hn.algolia.com",
"web_accessible_resources": ["sidebar.html", "js/*.map", "js/generated/*.map", "js/generated/out/*"]
}

View File

@ -11,20 +11,22 @@
:plugins [[lein-cljsbuild "1.1.7"]]
:profiles {:cljs-shared
{:cljsbuild
{:builds [{:source-paths ["src"]
:compiler {:optimizations :simple
:pretty-print true
:source-map true
:output-dir "ext/js/generated/out"
:modules {:background
{:output-to "ext/js/generated/background.js"
:entries #{"looped-in.background"}}
:content
{:output-to "ext/js/generated/content.js"
:entries #{"looped-in.content"}}
:sidebar
{:output-to "ext/js/generated/sidebar.js"
:entries #{"looped-in.sidebar"}}}}}]}}
:dev {:dependencies [[com.cemerick/piggieback "0.2.2"]
{:builds
{:main
{:source-paths ["src"]
:compiler {:optimizations :simple
:pretty-print true
:source-map true
:output-dir "ext/js/generated/out"
:modules {:background
{:output-to "ext/js/generated/background.js"
:entries #{"looped-in.background"}}
:content
{:output-to "ext/js/generated/content.js"
:entries #{"looped-in.content"}}
:sidebar
{:output-to "ext/js/generated/sidebar.js"
:entries #{"looped-in.sidebar"}}}}}}}}
:dev {:deoendencies [[com.cemerick/piggieback "0.2.2"]
[org.clojure/tools.nrepl "0.2.10"]]
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}})

View File

@ -9,7 +9,7 @@
(defn do-not-track
"Returns true if Do Not Track is enabled"
[]
(= (.-doNotTrack js/navigator) 1))
(= (.-doNotTrack js/navigator) "1"))
(defn init-amplitude
"Injects the Amplitude bootstrapping script if DNT is disabled"