Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(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
You can’t perform that action at this time.