Skip to content

Instantly share code, notes, and snippets.

@andrewsuzuki
Last active December 8, 2019 15:31
Show Gist options
  • Save andrewsuzuki/fd9edda14296fd03483b0dbe40ee3a99 to your computer and use it in GitHub Desktop.
Save andrewsuzuki/fd9edda14296fd03483b0dbe40ee3a99 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