1.0.0 • Published 6 years ago

@vinks/inbound v1.0.0

Weekly downloads
13
License
-
Repository
github
Last release
6 years ago

PureClarity inbound


Based on the original Segment.io inbound lib

Original lib appears to have been out of active dev since 2013

This is likely because some of the incoming services can no longer be correctly parsed (such as google search)

inbound is a referrer parsing library for node.js / express web apps.

Includes referrers for social media sites, search, email providers and ads

Supported Matchers

Social

Search

Email Clients

Ads

Internal

Internal referrers occur when a visitor navigates between two pages of the same domain. Example: http://site.com => http://site.com/about

Link

If there is a referrer present but it's unrecognized above, we'll just call it a link referrer.

Direct

When a visitor navigates to a site by typing in the url into the address bar, document.referrer is blank. This is called a direct referral. (There are some other reasons this can happen as well.)

Utilities

Shorten API

If you want to count the number of people who came from a specific referrer, you might want to make the following map:

referrer => { set_of_visitors }

However, referrers and urls tend to have differences that don't really matter to you, but are slightly different.

Use the inbound.shorten API to make the referrers and domains unique.

inbound.shorten.url('https://segment.io/?imm_mid=094f89&cmp=em-npa-ug-nl-sep15-html')
// "segment.io"

inbound.shorten.url('http://ianstormtaylor.com/oocss-plus-sass-is-the-best-way-to-css/?utm_source=hackernewsletter&utm_medium=email')
// "ianstormtaylor.com/oocss-plus-sass-is-the-best-way-to-css

Contribute

Contributors

Matchers

Matchers help identify and attach more semantic information to referral sources. We'd your help on adding the hundreds of social, search, ad, and other referral sources not matched yet by inbound.

To add matchers:

  1. Using existing matchers as an example, create your matcher at /lib/matchers/.
  2. Add your matcher to the priority list of matchers in index.js.
  3. Add your test cases to the test cases file.
  4. Run and confirm that your test cases pass: npm test

  5. Add your matcher to the readme.

  6. Submit your pull request!

Advanced

Why is my document.referrer blank?

  1. The visitor came directly to your site by typing the link into the browser's bar.
  2. The visitor clicked a link on an https:// page and arrived at a http:// page, such as clicking a link to http://hypem.com on a https://gmail.com email. (Chrome will strip the referrer since you're downgrading security).
  3. You were 301 redirected via a proxy that didn't maintain the referrer header.

Why is the matchers API asynchronous?

Even though most matchers do synchronous string matching, leaving the API asynchronous allows matchers that fill in more semantic information about the referrer by hitting some sort of API.

License

WWWWWW||WWWWWW
 W W W||W W W
      ||
    ( OO )__________
     /  |           \
    /o o|    MIT     \
    \___/||_||__||_|| *
         || ||  || ||
        _||_|| _||_||
       (__|__|(__|__|