URL Enrichment

It is very helpful to look into URLs when you are trying to do analysis on traffic throughout a website. This enrichment will take a well-formed URL and parse it into its component pieces for rich multi-dimensional analysis.

If you want to start using this 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 5 different properties:

Property name Description
protocol A string containing the protocol of the URL (http or https).
domain A string containing the domain of the URL. ie: “keen.io”
path A string containing the path of the URL. ie: “/super-awesome-content”
anchor A string containing the anchor tag of the URL. ie: “title”
query_string An object containing key:value pairs of each parameter in the query string. ie: “source” : “twitter”

If the URL is missing any of the output parameters described above, they will be omitted from the recorded output object.

To Activate URL Enrichment

The parameters for the URL enrichment are as follows:

Parameter Description
name “keen:url_parser”
input An object with a key of “url” and a value of the name of the property containing the URL to parse.
{ "url": "property.containing.url" }
output A property name describing where the produced object should be stored.

Your Event Data Model

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

{
  "page_url": "http://my-website.com/cool/link?source=twitter&foo=bar/#title",
  "keen": {
    "addons": [{
      "name": "keen:url_parser",
      "input": {
        "url": "page_url"
      },
      "output": "parsed_page_url"
    }]
  }
}

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

{
  "page_url": "http://my-website.com/cool/link?source=twitter&foo=bar/#title",
  "parsed_page_url": {
    "protocol": "http",
    "domain": "my-website.com",
    "path": "/cool/link",
    "anchor": "title",
    "query_string": {
      "source": "twitter",
      "foo": "bar"
    }
  },
  "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

You might want to see what the daily traffic is like on some pages compared to others.

Count parsed_page_url.path group_by with daily interval:

Group by URL path with daily interval

If you have mutliple domains you are tracking, you can easily compare their daily traffic over time.

Count parsed_page_url.domain group_by with daily interval:

Group by URL domain with daily interval