Rakam enriches and cleans events collected by Rakam instances via event mappers. Event mappers nodes processes events and attaches additional fields or clean them by removing existing fields.
Currently, Rakam provides a limited set of event mappers for common use cases, you can also extend Rakam by writing custom event mappers and attaching them your Rakam nodes.
Here are the list of event mappers provided by Rakam:
Attaches a set of geolocation related fields to events based on ip field of events or socket address of the event collection request.
By default, it uses community version of
MaxMind GeoIP API,
if you already have enterprise version on
MaxMind GeoIP2, you can also use it as ip-to-geolocation database.
For example; if you want to create a website analytics service using Rakam and give the ability to your users analyze the visitors' location information,
you need to attach location information to visitors' events.
Unfortunately, browsers doesn't share location information by default and requires additional permission to give you the accurate geolocation information. (HTML Geolocation)
Moreover, the HTML Geolocation API is not available in older browsers so you need a ip-to-geolocation database that resolves IP to location data and attach events the location information using event mappers.
Currently, IP Geolocation module supports these attributes:
ip field will be used to resolve geolocation data but you can also customize module to use the socket address of the event collection request.
referrer attribute of the events, analyze referer address and attaches additional attributes
referrer_term that are related with referrer address.
It uses Snowplow Referer Parser library under the hood.
user_agent attribute that contains raw user-agent data of the events,
extract it and attaches
device_family attributes to the event.
It also removes
user_agent attribute from the events since the added attributes already represent it.
ua-parser library in order to parse user agent attribute.
Some of the modules uses custom event mappers to attach additional information to events and use them later when analyzing events.
For example, event explorer module and real-time modules attaches time attribute to the events that represents the collection time.
Then they use that attribute when processing and grouping events.
Developing custom event mappers is fairly easy. You need to create class that implements
and make your event mapper identified by Rakam by adding is to EventMapper MultiBinder as follows:
Multibinder<EventMapper> multiBinder = Multibinder.newSetBinder(binder, EventMapper.class); multiBinder.addBinding().to(MyEventMapper.class).in(Scopes.SINGLETON);
You must also add
@AutoService(RakamModule.class) annotation to your modules in order add them to Rakam runtime.
Updated almost 3 years ago