RefInspector v1.0.0 RefInspector View Source

Referer parser library.

Preparation

  1. Verify your supervision setup according to RefInspector.Supervisor
  2. Revise the default configuration values of RefInspector.Config and adjust to your project/environment where necessary
  3. Download a copy of the parser database file(s) as outlined in RefInspector.Downloader

Usage

iex> RefInspector.parse("http://www.google.com/search?q=ref_inspector")
%RefInspector.Result{
  referer: "http://www.google.com/search?q=ref_inspector",
  medium: "search",
  source: "google",
  term: "ref_inspector"
}

Passing a referer string will result in a %RefInspector.Result{} returned with the following information (if available):

  • :referer will contain the unmodified referer passed to the parser.

  • :medium will be :unknown if no matching database entry could be found :internal, or a string matching the entry in the database. Detecting a referer as internal requires additional configuration.

  • :source will be :unknown if no known source could be detected. Otherwise it will contain a string with the provider’s name.

  • :term will be :none if no query parameters were given or the provider has no configured term parameters in the database (mostly relevant for social or email referers). If a configured term parameter was found it will be an unencoded string (possibly empty).

Note about Result Medium Atoms/Binaries

The medium atoms :unknown and :internal are specially treated to reflect two special cases. One being reserved for completely unknown referers and one being for configured domains to not be parsed.

Your database can still include "unknown" and "internal" sections. These will be parsed fully and returned using a binary as the medium instead of the aforementions atoms.

Link to this section Summary

Functions

Parses a referer

Checks if RefInspector is ready to perform lookups

Reloads all databases

Link to this section Functions

Parses a referer.

Checks if RefInspector is ready to perform lookups.

The true == ready? definition is made on the assumption that if there is at least one referer in the database the work intenden can be performed.

Checking the state is done using the currently active database. Any potentially concurrent reload requests are not considered.

Link to this function reload() View Source
reload() :: :ok

Reloads all databases.

This process is done asynchronously in the background, so be aware that for some time the old data will be used for lookups.