BoxLang 🚀 A New JVM Dynamic Language Learn More...


v1.0.0 Modules


A CFML wrapper for the userstack API. Use it to lookup and parse user-agent strings.

Feel free to use the issue tracker to report bugs or suggest improvements!


This project borrows heavily from the API frameworks built by jcberquist. Thanks to John for all the inspiration!

Table of Contents

Quick Start

Use of the component .

userstack = new access_key = 'xxx' );

ua = "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405";

result = userstack.detect( ua );

writeDump( var='#result#' );

Setup and Authentication

To get started with the Userstack API, you'll need an Access Key.

Once you have this, you can provide it to this wrapper manually when creating the component, as in the Quick Start example above, or via an environment variables named USERSTACK_ACCESS_KEY, which will get picked up automatically. This latter approach is generally preferable, as it keeps hardcoded credentials out of your codebase.

A Note About HTTPS

For reasons I don't understand, the secure endpoint for the API is restricted to paid plans. This wrapper implements the HTTPS endpoint as the default. Consequently, if you are on the free tier, you'll need to manually override the baseurl when you first init the component, like this:

  userstack new
    baseUrl = '',
    access_key = 'xxx'

Reference Manual

detect( required string ua, string fields, string callback, string output )

Lookup a single user-agent. The parameter ua specifies the User-Agent string to be looked up. The parameter fields [optional] can be used to specify API response field(s). Further docs

$ box install userstackcfc

No collaborators yet.
  • {{ getFullDate("2021-03-13T00:56:02Z") }}
  • {{ getFullDate("2021-03-13T00:56:02Z") }}
  • 1,377
  • 0