Skip to content

Instantly share code, notes, and snippets.

@digitalbase
Created April 23, 2020 19:44
Show Gist options
  • Select an option

  • Save digitalbase/0bb6796e9773815b4b16f32d7fdf70fa to your computer and use it in GitHub Desktop.

Select an option

Save digitalbase/0bb6796e9773815b4b16f32d7fdf70fa to your computer and use it in GitHub Desktop.
// src/utils/referrer_detection.util.js
const inbound = require('prezly-inbound');
module.exports = async(href, referrer) => {
console.log('going extraction', href, referrer);
return new Promise((resolve, reject) => {
inbound.referrer.parse(href, referrer, (error, data) => {
if (error) {
reject(error);
} else {
if (data.referrer.type === 'internal') {
resolve(null);
}
resolve(data);
}
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment