Skip to content

Instantly share code, notes, and snippets.

@sritchie
Forked from sorenmacbeth/gist:1112457
Created July 28, 2011 20:41
Show Gist options
  • Save sritchie/1112505 to your computer and use it in GitHub Desktop.
Save sritchie/1112505 to your computer and use it in GitHub Desktop.
(defn do-join [root]
(let [common ["!pub" "!datestr" "!country" "!region" "!city" "!kw" "!ref" "!url"]
zeroed ["?pageviews" "?landings" "?new-visits" "?return-visits" "?bounces"]
pv (pageviews root)
lnd (landings root)
nv (new-visits root)
rv (return-visits root)
b (bounces root)]
(<- [?json]
(pv :>> (conj common !!pvs))
(lnd :>> (conj common !!lnds))
(nv :>> (conj common !!nvs))
(rv :>> (conj common !!rvs))
(b :>> (conj common !!b))
(nil->zeroify !!pvs !!lnds !!nvs !!rvs !!b :>> zeroed)
(write-json-map [[:psn :d :url :g_C :g_r :g_c :kw :s :pv :l :nV :rV :b]]
:<< (concat (butlast common) zeroed) :> ?json))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment