Liking cljdoc? Tell your friends :D

privatus.analytics.ring

Ring middleware that adds the Privatus Analytics tag just before </head> in HTML responses.

Ring middleware that adds the Privatus Analytics tag just before </head> in
HTML responses.
raw docstring

inject-tagclj

(inject-tag html tag-html)

Puts the tag before the first </head> of an HTML string, unless the page has no </head> or already loads /js/pa.js.

Puts the tag before the first </head> of an HTML string, unless the page has
no </head> or already loads /js/pa.js.
sourceraw docstring

wrap-privatus-analyticsclj

(wrap-privatus-analytics handler)
(wrap-privatus-analytics handler config)

Adds the tag to the <head> of HTML responses.

(wrap-privatus-analytics handler {:site-id "pa_YOURSITEID" :props (fn [request] {:plan (plan-of request)})})

config takes the same keys as privatus.analytics/tag. :props and :nonce may be functions that get the Ring request. :auto-inject false turns it off.

Only 200 responses with a text/html content type are changed, and only when they have no Content-Encoding, are not Ajax requests (X-Requested-With: XMLHttpRequest), have a </head> and do not already load /js/pa.js. String, InputStream, File, byte array and seq bodies are read. Any other body is left alone. Content-Length is set to the new size. Works with both sync and async Ring handlers.

Adds the tag to the <head> of HTML responses.

  (wrap-privatus-analytics handler {:site-id "pa_YOURSITEID"
                                    :props (fn [request] {:plan (plan-of request)})})

config takes the same keys as privatus.analytics/tag. :props and :nonce may
be functions that get the Ring request. :auto-inject false turns it off.

Only 200 responses with a text/html content type are changed, and only when
they have no Content-Encoding, are not Ajax requests (X-Requested-With:
XMLHttpRequest), have a </head> and do not already load /js/pa.js.
String, InputStream, File, byte array and seq bodies are read. Any other body
is left alone. Content-Length is set to the new size.
Works with both sync and async Ring handlers.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close