Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
description of edits to enhance server.js for node-boilerplate
<script>SOCKET_IO_PORT = <%= port %>;</script>
<script src="/js/socket.io.js"></script>
...
<!-- mathiasbynens.be/notes/async-analytics-snippet Change UA-XXXXX-X to be your site's ID -->
<script>
var _gaq=[["_setAccount","<%= googleAnalyticsSiteId %>"],["_trackPageview"]];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
s.parentNode.insertBefore(g,s)}(document,"script"));
</script>
...
//io.setPath('/client/');
socket = new io.Socket(null, {
port: SOCKET_IO_PORT
,transports: ['websocket', 'htmlfile', 'xhr-multipart', 'xhr-polling']
,path: '/client/'
});
...
// at the top of the file, or in a site config file:
var googleAnalyticsSiteId = 'UA-XXXXX-X';
...
// THREE PLACES: 404, 500, index, etc. Consider using a default "locals" object that is extended for each instance.
res.render('VARIOUS TEMPLATES', {locals: {
...
googleAnalyticsSiteId: googleAnalyticsSiteId,
port: port // only needed for the index.ejs route
}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.