Avatar photo

Access Key Creation and Management Tool for User-facing Metrics

Here at Keen we’ve built the user-facing metrics and analytics API including a tool for creating Access Keys. Access Keys are authentication tokens that can be used to grant permission to read or write data to Keen, or automatically enrich events with entity data.

The UI tool for managing Access Keys gives you a simple point-and-click method for generating keys, as well as an easy way to see all of the keys you have created. Of course, as always these Keys can be provisioned and customized via our lovingly-crafted API programmatically.

In case you’re not familiar with custom API Access Keys, the main use case for creating an Access Key is security. By defining custom permissions for different users, you can lean on Keen’s security features to serve data + end users analytics instead of building your own tools from scratch.

Some other use cases for custom Access Keys include:

  • You’d like to build in custom permissions and follow security best practices
  • You’re presenting end user dashboards with analytics to your customers and want to ensure that customer A can’t see customer B’s data
  • When writing data you want to make sure that customer A & B’s data streams don’t mix
  • You’d like to make sure administrative operations in Keen (such as deletes) are not granted to all
  • You’d like to stream in data from other sources via webhook and still take advantage of Keen’s Data Enrichments
  • You’re interested in adding entity data or Master Data to every event

Your Access Key can allow you to add entity data to each of your events — this is a powerful ability. By specifying what you’d like to append just once in the Access Key’s autofill property, you can bake a particular user, customer, or company’s entity data into each event. For example:

“autofill”: { “user_id”: 232130982, “name”: “Some Name” }

Boom💥 These properties will show up in every single event written with that key.

Autofill can also be used to enrich your incoming webhook data stream via Keen’s Data Enrichment Add-Ons. If you’re streaming SendGrid email data, long URL strings which exist in all Click events can be enriched and parsed to become more useful using the URL Enrichment. (Note: Because it’s a webhook, if a property is missing we currently have no way of notifying you if events fail. As always, test your integration.)

The SendGrid data model also includes in each event the IP address, so wherever a user opens the email you can maximize the power of the Access Keys and use autofill to enrich those Opened events with IP to Geo Data. Heck, enrich all of your events. Keen has five data enrichment tools for even more cool analyses.😋

Here’s an example Access Key definition. You’ll see the autofill property being used to include some entity data + the IP to Geo and User Agent Data Enrichments:

{ 
  "name": "Access Key for Acme Corp with Data Enrichments",
  "is_active": true,
  "permitted": ["writes"],
  "options": { 
    "writes": { 
      "autofill": { 
        "customer": {
          "id": "93iskds39kd93id",
          "name": "Acme Corp."
        },
      "keen": {
        "addons": [ // Keen Addons to be used
          { 
            "name": "keen:ip_to_geo", // IP to Geo parser add-on
            "input": {
              "ip": "ip_address" // Make sure the "ip_address" field exists in each event sent
            }, 
            "output" : "geo"
          },
          {
            "name": "keen:ua_parser", // User Agent parser add-on
            "input": {
              "ua_string": "user_agent" // Make sure the “user_agent” field exists in each event sent 
            }, 
            "output": "tech" 
          }
        ]
      }
    }
  }
} // continue rest of Access Key definition }

Do you have a use case where you might want to define and manage fine-grained permissions for who can access your data streams and analytics? Thinking of ways you can incorporate data enrichments or entity data into your events?

Start building with Keen and try it out!