Skip to content

Instantly share code, notes, and snippets.

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