Skip to content

Instantly share code, notes, and snippets.

@groundedsage
Forked from andrewsuzuki/analytics.cljs
Created February 16, 2017 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save groundedsage/e8fc57302d455373b5474c68ee815947 to your computer and use it in GitHub Desktop.
Save groundedsage/e8fc57302d455373b5474c68ee815947 to your computer and use it in GitHub Desktop.
clojurescript google analytics autotrack
(ns MY_NAMESPACE.analytics
(:require [cljsjs.google-analytics]
[autotrack]))
(def tracking-code "UA-XXXXX-Y")
(defn start []
(js/ga "create" tracking-code "auto")
(js/ga "require" "autotrack")
(js/ga "send" "pageview"))
;;; Analytics
;; lein
[cljsjs/google-analytics "2015.04.13-0"]
;;; Autotrack
;; npm install --save autotrack
;; then add the following compiler option into relevant build configurations
:foreign-libs [{:file "node_modules/autotrack/autotrack.js"
:provides ["autotrack"]}]}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment