@@ -24,7 +24,7 @@ var app = express();
2424// but will need to be manually set when running locally. See README.md.
2525var GA_TRACKING_ID = process . env . GA_TRACKING_ID ;
2626
27- function trackEvent ( category , action , label , value , cb ) {
27+ function trackEvent ( category , action , label , value , cb ) {
2828 var data = {
2929 v : '1' , // API Version.
3030 tid : GA_TRACKING_ID , // Tracking ID / Property ID.
@@ -35,14 +35,14 @@ function trackEvent(category, action, label, value, cb) {
3535 ec : category , // Event category.
3636 ea : action , // Event action.
3737 el : label , // Event label.
38- ev : value , // Event value.
38+ ev : value // Event value.
3939 } ;
4040
4141 request . post (
4242 'http://www.google-analytics.com/collect' , {
4343 form : data
4444 } ,
45- function ( err , response ) {
45+ function ( err , response ) {
4646 if ( err ) { return cb ( err ) ; }
4747 if ( response . statusCode !== 200 ) {
4848 return cb ( new Error ( 'Tracking failed' ) ) ;
@@ -52,13 +52,13 @@ function trackEvent(category, action, label, value, cb) {
5252 ) ;
5353}
5454
55- app . get ( '/' , function ( req , res , next ) {
55+ app . get ( '/' , function ( req , res , next ) {
5656 trackEvent (
5757 'Example category' ,
5858 'Example action' ,
5959 'Example label' ,
6060 '100' , // Event value must be numeric.
61- function ( err ) {
61+ function ( err ) {
6262 // This sample treats an event tracking error as a fatal error. Depending
6363 // on your application's needs, failing to track an event may not be
6464 // considered an error.
@@ -68,9 +68,8 @@ app.get('/', function(req, res, next) {
6868} ) ;
6969
7070// Start the server
71- var server = app . listen ( process . env . PORT || 8080 , '0.0.0.0' , function ( ) {
72- console . log ( 'App listening at http://%s:%s' , server . address ( ) . address ,
73- server . address ( ) . port ) ;
71+ var server = app . listen ( process . env . PORT || 8080 , function ( ) {
72+ console . log ( 'App listening on port %s' , server . address ( ) . port ) ;
7473 console . log ( 'Press Ctrl+C to quit.' ) ;
7574} ) ;
7675// [END app]
0 commit comments