Skip to content

Instantly share code, notes, and snippets.

@codebubb
Created October 28, 2020 09:16
Show Gist options
  • Select an option

  • Save codebubb/799337799ecb23e7f51e67dcc0b7d621 to your computer and use it in GitHub Desktop.

Select an option

Save codebubb/799337799ecb23e7f51e67dcc0b7d621 to your computer and use it in GitHub Desktop.
Beacon and PageVisibility API
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.text());
app.use(express.static('public'));
app.post('/log', (req, res) => {
console.log('Received Beacon: ', JSON.parse(req.body));
});
app.listen(3000, console.log('App listening...'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment