Created
May 29, 2013 11:36
-
-
Save joshleaves/5669653 to your computer and use it in GitHub Desktop.
How to use node-ga with routes instead of as a middleware. Based on the third example from http://expressjs.com/api#app.VERB ("Several callbacks may also be passed, useful for re-using middleware that load resources, perform validations, etc.")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ga = require('node-ga')('UA-XXXXXXXX-Y', { safe: true}); | |
/* your usual express options */ | |
app.get('/logged-route', ga, LoggedRouteHandler); | |
app.get('/non-logged-route', NonLoggedRouteHandler); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment