Skip to content

Commit

Permalink
Add a platform context plugin to the React Native tracker to track de…
Browse files Browse the repository at this point in the history
…vice information
  • Loading branch information
matus-tomlein committed Nov 28, 2024
1 parent 0a00be2 commit 584a62b
Show file tree
Hide file tree
Showing 41 changed files with 1,335 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| Enumeration | Description |
| --- | --- |
| [LOG\_LEVEL](./react-native-tracker.log_level.md) | |
| [PlatformContextProperty](./react-native-tracker.platformcontextproperty.md) | |

## Functions

Expand Down Expand Up @@ -39,6 +40,8 @@
| [Logger](./react-native-tracker.logger.md) | |
| [PageViewEvent](./react-native-tracker.pageviewevent.md) | A Page View Event Represents a Page View, which is typically fired as soon as possible when a web page is loaded within the users browser. Often also fired on "virtual page views" within Single Page Applications (SPA). |
| [PayloadBuilder](./react-native-tracker.payloadbuilder.md) | Interface for mutable object encapsulating tracker payload |
| [PlatformContextConfiguration](./react-native-tracker.platformcontextconfiguration.md) | |
| [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) | Overrides for the values for properties of the platform context. |
| [RuleSet](./react-native-tracker.ruleset.md) | A ruleset has accept or reject properties that contain rules for matching Iglu schema URIs |
| [SessionConfiguration](./react-native-tracker.sessionconfiguration.md) | Configuration for session tracking |
| [StructuredEvent](./react-native-tracker.structuredevent.md) | A Structured Event A classic style of event tracking, allows for easier movement between analytics systems. A loosely typed event, creating a Self Describing event is preferred, but useful for interoperability. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Creates a new tracker instance with the given configuration
<b>Signature:</b>

```typescript
export declare function newTracker(configuration: TrackerConfiguration & EmitterConfiguration & SessionConfiguration & SubjectConfiguration & EventStoreConfiguration): Promise<ReactNativeTracker>;
export declare function newTracker(configuration: TrackerConfiguration & EmitterConfiguration & SessionConfiguration & SubjectConfiguration & EventStoreConfiguration & PlatformContextConfiguration): Promise<ReactNativeTracker>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| configuration | [TrackerConfiguration](./react-native-tracker.trackerconfiguration.md) &amp; EmitterConfiguration &amp; [SessionConfiguration](./react-native-tracker.sessionconfiguration.md) &amp; [SubjectConfiguration](./react-native-tracker.subjectconfiguration.md) &amp; [EventStoreConfiguration](./react-native-tracker.eventstoreconfiguration.md) | Configuration for the tracker |
| configuration | [TrackerConfiguration](./react-native-tracker.trackerconfiguration.md) &amp; EmitterConfiguration &amp; [SessionConfiguration](./react-native-tracker.sessionconfiguration.md) &amp; [SubjectConfiguration](./react-native-tracker.subjectconfiguration.md) &amp; [EventStoreConfiguration](./react-native-tracker.eventstoreconfiguration.md) &amp; [PlatformContextConfiguration](./react-native-tracker.platformcontextconfiguration.md) | Configuration for the tracker |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextConfiguration](./react-native-tracker.platformcontextconfiguration.md)

## PlatformContextConfiguration interface

<b>Signature:</b>

```typescript
export interface PlatformContextConfiguration
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [platformContext?](./react-native-tracker.platformcontextconfiguration.platformcontext.md) | boolean | <i>(Optional)</i> Whether to track the mobile context with information about the device. Note: Only some properties (osType, osVersion, deviceManufacturer, deviceModel, resolution, language, scale) will be tracked by default. Other properties can be assigned using the PlatformContextRetriever. |
| [platformContextProperties?](./react-native-tracker.platformcontextconfiguration.platformcontextproperties.md) | [PlatformContextProperty](./react-native-tracker.platformcontextproperty.md)<!-- -->\[\] | <i>(Optional)</i> List of properties of the platform context to track. If not passed and <code>platformContext</code> is enabled, all available properties will be tracked. The required <code>osType</code>, <code>osVersion</code>, <code>deviceManufacturer</code>, and <code>deviceModel</code> properties will be tracked in the entity regardless of this setting. |
| [platformContextRetriever?](./react-native-tracker.platformcontextconfiguration.platformcontextretriever.md) | [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) | <i>(Optional)</i> Set of callbacks to be used to retrieve properties of the platform context. Overrides the tracker implementation for setting the properties. |

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextConfiguration](./react-native-tracker.platformcontextconfiguration.md) &gt; [platformContext](./react-native-tracker.platformcontextconfiguration.platformcontext.md)

## PlatformContextConfiguration.platformContext property

Whether to track the mobile context with information about the device. Note: Only some properties (osType, osVersion, deviceManufacturer, deviceModel, resolution, language, scale) will be tracked by default. Other properties can be assigned using the PlatformContextRetriever.

<b>Signature:</b>

```typescript
platformContext?: boolean;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextConfiguration](./react-native-tracker.platformcontextconfiguration.md) &gt; [platformContextProperties](./react-native-tracker.platformcontextconfiguration.platformcontextproperties.md)

## PlatformContextConfiguration.platformContextProperties property

List of properties of the platform context to track. If not passed and `platformContext` is enabled, all available properties will be tracked. The required `osType`<!-- -->, `osVersion`<!-- -->, `deviceManufacturer`<!-- -->, and `deviceModel` properties will be tracked in the entity regardless of this setting.

<b>Signature:</b>

```typescript
platformContextProperties?: PlatformContextProperty[];
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextConfiguration](./react-native-tracker.platformcontextconfiguration.md) &gt; [platformContextRetriever](./react-native-tracker.platformcontextconfiguration.platformcontextretriever.md)

## PlatformContextConfiguration.platformContextRetriever property

Set of callbacks to be used to retrieve properties of the platform context. Overrides the tracker implementation for setting the properties.

<b>Signature:</b>

```typescript
platformContextRetriever?: PlatformContextRetriever;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextProperty](./react-native-tracker.platformcontextproperty.md)

## PlatformContextProperty enum

<b>Signature:</b>

```typescript
export declare enum PlatformContextProperty
```

## Enumeration Members

| Member | Value | Description |
| --- | --- | --- |
| AndroidIdfa | <code>&quot;androidIdfa&quot;</code> | Advertising identifier on Android. Note: This is not automatically assigned by the tracker as it may be considered as fingerprinting. You can assign it using the PlatformContextRetriever. |
| AppAvailableMemory | <code>&quot;appAvailableMemory&quot;</code> | Amount of memory in bytes available to the current app. The property is not tracked in the current version of the tracker due to the tracker not being able to access the API, see the issue here: https://github.com/snowplow/snowplow-ios-tracker/issues/772 Note: this property is not automatically assigned but can be assigned using the PlatformContextRetriever. |
| AppleIdfa | <code>&quot;appleIdfa&quot;</code> | Advertising identifier on iOS. Note: this property is not automatically assigned but can be assigned using the PlatformContextRetriever. |
| AppleIdfv | <code>&quot;appleIdfv&quot;</code> | UUID identifier for vendors on iOS. Note: this property is not automatically assigned but can be assigned using the PlatformContextRetriever. |
| AppSetId | <code>&quot;appSetId&quot;</code> | Android vendor ID scoped to the set of apps published under the same Google Play developer account (see https://developer.android.com/training/articles/app-set-id). Note: This is not automatically assigned by the tracker as it may be considered as fingerprinting. You can assign it using the PlatformContextRetriever. |
| AppSetIdScope | <code>&quot;appSetIdScope&quot;</code> | Scope of the <code>appSetId</code>. Can be scoped to the app or to a developer account on an app store (all apps from the same developer on the same device will have the same ID). Note: This is not automatically assigned by the tracker as it may be considered as fingerprinting. You can assign it using the PlatformContextRetriever. |
| AvailableStorage | <code>&quot;availableStorage&quot;</code> | Bytes of storage remaining. Note: This is not automatically assigned by the tracker as it may be considered as fingerprinting. You can assign it using the PlatformContextRetriever. |
| BatteryLevel | <code>&quot;batteryLevel&quot;</code> | Remaining battery level as an integer percentage of total battery capacity. Note: this property is not automatically assigned but can be assigned using the PlatformContextRetriever. |
| BatteryState | <code>&quot;batteryState&quot;</code> | Battery state for the device. Note: this property is not automatically assigned but can be assigned using the PlatformContextRetriever. |
| Carrier | <code>&quot;carrier&quot;</code> | The carrier of the SIM inserted in the device. Note: this property is not automatically assigned but can be assigned using the PlatformContextRetriever. |
| IsPortrait | <code>&quot;isPortrait&quot;</code> | A Boolean indicating whether the device orientation is portrait (either upright or upside down). Note: This is not automatically assigned by the tracker as it may be considered as fingerprinting. You can assign it using the PlatformContextRetriever. |
| Language | <code>&quot;language&quot;</code> | System language currently used on the device (ISO 639). |
| LowPowerMode | <code>&quot;lowPowerMode&quot;</code> | A Boolean indicating whether Low Power Mode is enabled. |
| NetworkTechnology | <code>&quot;networkTechnology&quot;</code> | Radio access technology that the device is using. Note: this property is not automatically assigned but can be assigned using the PlatformContextRetriever. |
| NetworkType | <code>&quot;networkType&quot;</code> | Type of network the device is connected to. Note: this property is not automatically assigned but can be assigned using the PlatformContextRetriever. |
| PhysicalMemory | <code>&quot;physicalMemory&quot;</code> | Total physical system memory in bytes. Note: this property is not automatically assigned but can be assigned using the PlatformContextRetriever. |
| Resolution | <code>&quot;resolution&quot;</code> | Screen resolution in pixels. Arrives in the form of WIDTHxHEIGHT (e.g., 1200x900). Doesn't change when device orientation changes. Note: This is not automatically assigned by the tracker as it may be considered as fingerprinting. You can assign it using the PlatformContextRetriever. |
| Scale | <code>&quot;scale&quot;</code> | Scale factor used to convert logical coordinates to device coordinates of the screen (uses UIScreen.scale on iOS). |
| SystemAvailableMemory | <code>&quot;systemAvailableMemory&quot;</code> | Available memory on the system in bytes (Android only). Note: This is not automatically assigned by the tracker as it may be considered as fingerprinting. You can assign it using the PlatformContextRetriever. |
| TotalStorage | <code>&quot;totalStorage&quot;</code> | Total size of storage in bytes. Note: This is not automatically assigned by the tracker as it may be considered as fingerprinting. You can assign it using the PlatformContextRetriever. |

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getAndroidIdfa](./react-native-tracker.platformcontextretriever.getandroididfa.md)

## PlatformContextRetriever.getAndroidIdfa property

Advertising identifier on Android.

<b>Signature:</b>

```typescript
getAndroidIdfa?: () => Promise<string | undefined>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getAppAvailableMemory](./react-native-tracker.platformcontextretriever.getappavailablememory.md)

## PlatformContextRetriever.getAppAvailableMemory property

Amount of memory in bytes available to the current app

<b>Signature:</b>

```typescript
getAppAvailableMemory?: () => Promise<number | undefined>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getAppleIdfa](./react-native-tracker.platformcontextretriever.getappleidfa.md)

## PlatformContextRetriever.getAppleIdfa property

Advertising identifier on iOS (UUID formatted string)

<b>Signature:</b>

```typescript
getAppleIdfa?: () => Promise<string | undefined>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getAppleIdfv](./react-native-tracker.platformcontextretriever.getappleidfv.md)

## PlatformContextRetriever.getAppleIdfv property

UUID identifier for vendors on iOS

<b>Signature:</b>

```typescript
getAppleIdfv?: () => Promise<string | undefined>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getAppSetId](./react-native-tracker.platformcontextretriever.getappsetid.md)

## PlatformContextRetriever.getAppSetId property

Android vendor ID scoped to the set of apps published under the same Google Play developer account (see https://developer.android.com/training/articles/app-set-id).

<b>Signature:</b>

```typescript
getAppSetId?: () => Promise<string | undefined>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getAppSetIdScope](./react-native-tracker.platformcontextretriever.getappsetidscope.md)

## PlatformContextRetriever.getAppSetIdScope property

Scope of the `appSetId`<!-- -->. Can be scoped to the app or to a developer account on an app store (all apps from the same developer on the same device will have the same ID).

<b>Signature:</b>

```typescript
getAppSetIdScope?: () => Promise<string | undefined>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getAvailableStorage](./react-native-tracker.platformcontextretriever.getavailablestorage.md)

## PlatformContextRetriever.getAvailableStorage property

Bytes of storage remaining

<b>Signature:</b>

```typescript
getAvailableStorage?: () => Promise<number | undefined>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getBatteryLevel](./react-native-tracker.platformcontextretriever.getbatterylevel.md)

## PlatformContextRetriever.getBatteryLevel property

Remaining battery level as an integer percentage of total battery capacity

<b>Signature:</b>

```typescript
getBatteryLevel?: () => Promise<number | undefined>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getBatteryState](./react-native-tracker.platformcontextretriever.getbatterystate.md)

## PlatformContextRetriever.getBatteryState property

Battery state for the device

<b>Signature:</b>

```typescript
getBatteryState?: () => Promise<'unplugged' | 'charging' | 'full' | undefined>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getCarrier](./react-native-tracker.platformcontextretriever.getcarrier.md)

## PlatformContextRetriever.getCarrier property

The carrier of the SIM inserted in the device

<b>Signature:</b>

```typescript
getCarrier?: () => Promise<string | undefined>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getDeviceManufacturer](./react-native-tracker.platformcontextretriever.getdevicemanufacturer.md)

## PlatformContextRetriever.getDeviceManufacturer property

The manufacturer of the product/hardware

<b>Signature:</b>

```typescript
getDeviceManufacturer?: () => Promise<string>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getDeviceModel](./react-native-tracker.platformcontextretriever.getdevicemodel.md)

## PlatformContextRetriever.getDeviceModel property

The end-user-visible name for the end product

<b>Signature:</b>

```typescript
getDeviceModel?: () => Promise<string>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/react-native-tracker](./react-native-tracker.md) &gt; [PlatformContextRetriever](./react-native-tracker.platformcontextretriever.md) &gt; [getLanguage](./react-native-tracker.platformcontextretriever.getlanguage.md)

## PlatformContextRetriever.getLanguage property

System language currently used on the device (ISO 639)

<b>Signature:</b>

```typescript
getLanguage?: () => Promise<string | undefined>;
```
Loading

0 comments on commit 584a62b

Please sign in to comment.