Analytics Everywhere | The Universal Measurement Protocol C Library
Well, we’re at it again… releasing another Universal Analytics library, this time in C. [And if you're wondering why, check this out.]
So let’s see, what interesting things are built in C (or compatible derivatives)…
- Embedded devices
- Lots of appliances, including TVs
- Communications platforms, including phones
- Point-of-sale devices
- Hand-held record-keeping devices, such as those carried by parcel service delivery personnel
- Security systems
- Media platforms, like the ones streaming content to your TV
- Operating systems
- Video games
- Desktop software
- Database software
- Statistical analysis packages
Basically anything that needs to run really fast, or with really efficient (limited) resources, is probably written in a language that compiles in a way that can link in a C library.
Get the Code
|C (and derivatives)||github.com/analytics-pros/universal-analytics-c|
C is a unique language in some respects, and since we’re aiming for maximum efficiency, we’ve crafted a few alternative approaches to keep the library easy to use, while varying somewhat from the syntax and flexibility of the other libraries we’ve released. In particular:
- Defining parameters (e.g. custom dimensions) is handled through enum constants, rather than strings (i.e. the parameter name). This produces a direct mapping of the fields into the tracker’s memory, making it really fast.
- Tracking behaviors are implemented through C functions, without classes, since C doesn’t really support them. The interface should still be quite intuitive and usable for anyone familiar with C though.
Important technical details:
- This library is still quite young, and may have bugs we haven’t found yet. It’s open-source, so we welcome your input and contributions
- This version requires CURL, which has lots of other dependencies, and may be complicated to integrate on some platforms. To that end we’ve decoupled the HTTP integration, and would love to see patches, or hear your ideas on supporting alternative HTTP libraries.
- We’ve tried to minimize dynamic memory allocation, and consolidated allocation into the tracker object itself, which should simplify prediction of memory requirements. CURL internally requires some dynamic allocation, but our