Created
July 23, 2018 13:05
-
-
Save ankitadhandha/20da90b0f42d2752fd86d79b3abd5403 to your computer and use it in GitHub Desktop.
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 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(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
comment here