Snowplow C++ Tracker
2.0.0
Snowplow event tracker for C++. Add analytics to your C++ applications, games and servers
|
Subject information describes the user and device associated with the event, such as their user ID, what type of device they used, or what size screen that device had.
Create a subject like this and add it to your tracker using the Snowplow::create_tracker
call:
You can also attach custom Subject information to individual events. In this way, you may track events describing different users or devices using the same tracker. Events can be assigned a shared C++ pointer to a Subject instance using the set_subject
method. The following example shows how to attach a subject instance to a structured event (see Tracking specific events for more information on tracking events):
The Subject class has a set of set...()
methods to attach extra data relating to the user to all tracked events:
set_user_id
set_screen_resolution
set_viewport
set_color_depth
set_timezone
set_language
set_useragent
set_ip_address
We will discuss each of these in turn below:
You can set the user ID to any string:
Example:
If your code has access to the device’s screen resolution, then you can pass this in to Snowplow too:
Both numbers should be positive integers; note the order is width followed by height. Example:
If your code has access to the viewport dimensions, then you can pass this in to Snowplow too:
Both numbers should be positive integers; note the order is width followed by height. Example:
If your code has access to the bit depth of the device’s color palette for displaying images, then you can pass this in to Snowplow too:
The number should be a positive integer, in bits per pixel. Example:
This method lets you pass a user’s timezone in to Snowplow:
The timezone should be a string:
This method lets you pass a user’s language in to Snowplow:
The language should be a string:
To change the user-agent string sent along with events to identify the application and system, you may set custom useragent using this method:
The user-agent should be a string:
To set the user's IP address, you may use this method:
The IP address should be a string:
If the IP address is not set, the events will be assigned the IP address from the HTTP request by the Collector.