Referrer Enrichment

When you are trying to find out if it was another website, an internal page, or a search engine referring to a page, the referrer enrichment can come to the rescue! We can even tell you the exact search term. This enrichment will take a well-formed referrer URL and parse it into its source.

If you want to start using the enrichment right now while tracking pageviews, clicks, and form submissions, check out the Web Auto-Collector.

When this enrichment is being used, you can do analysis on three different properties:

Property Description
medium A string containing the general category of the source of the referrer. See the chart below for potential mediums. ie: “SEARCH”
source A string containing the origin or source of the referrer. ie: “Google”
term A string containing the search term of the referrer, if it contains one.

Potential mediums could be:

Medium Description
UNKNOWN If the parser can’t figure out the medium.
INTERNAL If the domain of the referring URL matches the domain of the page_url.
SEARCH If search was the referrer.
EMAIL If an email client was the referrer.

A malformed page_url or referrer_url input parameter will result in blank output values.

To Activate Referrer Enrichment

The parameters for the Referrer enrichment are as follows:

Parameter Description
name “keen:referrer_parser”
input An object with two properties:
A key of “referrer_url” with a value of the name of the property containing the referrer URL to parse.
A key of “page_url” with a value of the name of the property containing the URL of the current page.
output A property name describing where the produced object should be stored.

To activate the enrichment, include the keen.addons object in your data model as seen below:

{
  "referrer": {
    "url": "https://search-engine.com?search=analytics"
  },
  "page": {
    "url": "http://mysite.com/landing-page"
  },
  "keen": {
    "addons": [{
      "name": "keen:referrer_parser",
      "input": {
        "referrer_url": "referrer.url",
        "page_url": "page.url"
      },
      "output": "referrer.info"
    }]
  }
}

The example above will create an output that looks like this:

{
  "referrer": {
    "url": "https://search-engine.com?search=analytics",
    "info": {
      "medium": "SEARCH",
      "source": "search-engine.com",
      "term": "analytics"
    }
  },
  "page": {
    "url": "http://mysite.com/landing-page"
  },
  "keen": {
    "created_at": "2012-12-14T20:24:01.123000+00:00",
    "timestamp": "2012-12-14T20:24:01.123000+00:00",
    "id": "asd9fadifjaqw9asdfasdf939"
  }
}

You can also find the API Reference section for this enrichment here.

Examples

It can be important to know where traffic is coming from, and you might want to see what search engines are referring users to your site.

Count pageviews with referrer.info.source group_by:

Group by search source

Or you might want to see what pages search engines are referring to.

Count pageviews with page.url group_by:

Group by page URL

Note: You could choose to use a chart for this analysis, but we found that a table shows the data the best.