Skip to content

Instantly share code, notes, and snippets.

@ankitadhandha
Created July 23, 2018 13:05
Show Gist options
  • Save ankitadhandha/20da90b0f42d2752fd86d79b3abd5403 to your computer and use it in GitHub Desktop.
Save ankitadhandha/20da90b0f42d2752fd86d79b3abd5403 to your computer and use it in GitHub Desktop.
var PaywallAccess = require('../../models/amp-access');
router.post('/amp-pingback', function(req, res) {
var readerId = req.query.rid;
if (!readerId) {
res.sendStatus(400);
return;
}
var paywallAccess = PaywallAccess.getOrCreate(readerId);
var viewedUrl = req.query.url;
var referrer = req.query.ref;
//count the view in case of metering
paywallAccess.registerView(referrer, viewedUrl);
console.log("paywallAccess views: " + paywallAccess.numViews);
console.log("FCF: ", referrer, paywallAccess.viewedUrlsByReferrer[referrer]);
res.status(200).end();
});
@jaygray0919
Copy link

comment here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment