### Firebase Installation ID Token Example Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/google/appInstanceIdToken.md An example JWT token used for Firebase authentication, containing the Firebase Installation ID (FID) and other relevant claims. ```text eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjE6MTA2NTQ3MzU5ODYyNDphbmRyb2lkOmQ3ODIwNzU2YzVjODA4ZGIwM2Q1YzUiLCJleHAiOjE3MTUwMDY3MDAsImZpZCI6ImVkeElubzhmVGY2WDR5X0s1WjYxNVAiLCJwcm9qZWN0TnVtYmVyIjoxMDY1NDczNTk4NjI0fQ.AB2LPV8wRAIgKWmNcG6EyL96sJbjdrK4fqE2IYusPUVw-cvxvQPfAOQCIBUOMpAbN88ZsfNHvUurgwOv7w8u1zT-7t4_mx_Wp8kN ``` -------------------------------- ### Android SDK: Get App Install Time Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/adjust/installed_at.md Retrieves the app's installation time from the Android system and formats it. ```java private String getAppInstallTime(Context context) { try { PackageManager packageManager = context.getPackageManager(); PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS); String appInstallTime = Util.dateFormatter.format(new Date(packageInfo.firstInstallTime)); return appInstallTime; } catch (Exception ex) { return null; } } ``` -------------------------------- ### Install TrackHAR Source: https://github.com/tweaselorg/trackhar/blob/main/README.md Instructions for installing the TrackHAR library using either yarn or npm package managers. ```sh yarn add trackhar # or `npm i trackhar` ``` -------------------------------- ### Get Application Install Date (Objective-C) Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/adjust/installed_at.md This Objective-C code snippet retrieves the application's installation date by dynamically linking symbols and accessing runtime information. It handles potential exceptions during the process and formats the date for output. Dependencies include Foundation and potentially other system frameworks for dynamic linking. ```objective-c int main() { @autoreleasepool { // ... (previous code) [inv setArgument:&errorPointer atIndex:3]; [inv invoke]; NSMutableDictionary * __unsafe_unretained tmpResult; [inv getReturnValue:&tmpResult]; NSMutableDictionary *result = tmpResult; CFStringRef *indexRef = dlsym(RTLD_SELF, [[NSString adjJoin:@"N", @"S", @"file", @"creation", @"date", nil] UTF8String]); NSString *ref = (__bridge_transfer id) *indexRef; installTime = result[ref]; } @catch (NSException *exception) { [logger error:@"Error while trying to check install date. Exception: %@", exception]; return nil; } return [ADJUtil formatDate:installTime]; } ``` -------------------------------- ### iOS SDK: Get App Install Time Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/adjust/installed_at.md Determines the app's installation time by examining file creation dates and formats it as a string. ```objc + (NSString *)installedAt { // […] @try { NSArray *paths = NSSearchPathForDirectoriesInDomains(folderToCheck, NSUserDomainMask, YES); if (paths.count > 0) { pathToCheck = [paths objectAtIndex:0]; } else { pathToCheck = [[NSBundle mainBundle] bundlePath]; } __autoreleasing NSError *error; __autoreleasing NSError **errorPointer = &error; Class class = NSClassFromString([NSString adjJoin:@"N", @"S", @"file", @"manager", nil]); if (class != nil) { NSString *keyDm = [NSString adjJoin:@"default", @"manager", nil]; SEL selDm = NSSelectorFromString(keyDm); if ([class respondsToSelector:selDm]) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Warc-performSelector-leaks" id man = [class performSelector:selDm]; #pragma clang diagnostic pop NSString *keyChk = [NSString stringWithFormat:@"%@%@", [NSString adjJoin:@"attributes", @"of", @"item", @"at", @"path", @":", nil], [NSString adjJoin:@"error", @":", nil]]; SEL selChk = NSSelectorFromString(keyChk); if ([man respondsToSelector:selChk]) { NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[man methodSignatureForSelector:selChk]]; [inv setSelector:selChk]; [inv setTarget:man]; [inv setArgument:&pathToCheck atIndex:2]; ``` -------------------------------- ### TrackHAR Decoding Step Example Source: https://github.com/tweaselorg/trackhar/blob/main/README.md An example illustrating the structure of `decodingSteps` in a TrackHAR adapter, showing how to parse JSON, extract properties, and process arrays using `mapInput`. ```js decodingSteps: [ { function: 'parseJson', input: 'body', output: 'b' }, { function: 'parseJson', input: 'b.batch', output: 'batch' }, { function: 'getProperty', mapInput: 'batch', options: { path: 'relative_url' }, output: 'relativeUrls' }, { function: 'parseQueryString', mapInput: 'relativeUrls', output: 'res.body.batch' }, { function: 'getProperty', input: 'b', options: { path: 'batch_app_id' }, output: 'res.body.batch_app_id' }, ] ``` -------------------------------- ### Facebook Adapter Match Method Example Source: https://github.com/tweaselorg/trackhar/blob/main/README.md This JavaScript code snippet demonstrates how to implement a 'match' method within a TrackHAR adapter. The method checks if the request content starts with a JSON object, indicating it's a Facebook-related request suitable for this adapter. ```javascript match: (request) => request.content?.startsWith('{\"') ``` -------------------------------- ### JWT Token Example Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/google/idToken.md This snippet shows an example of a JWT token used for user authentication. The token contains claims about the user and the issuing service. ```json { "provider_id": "anonymous", "iss": "https://securetoken.google.com/speechifymobile", "aud": "speechifymobile", "auth_time": 1690414398, "user_id": "jRBR50sdJDTz7IDRn94upPAHwjI2", "sub": "jRBR50sdJDTz7IDRn94upPAHwjI2", "iat": 1690414398, "exp": 1690417998, "firebase": { "identities": {}, "sign_in_provider": "anonymous" } } ``` -------------------------------- ### App Version ('av') Parameter Examples Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/singular-net/av.md Demonstrates the 'av' query parameter in TrackHar requests and its relationship to application versions. The 'av' parameter consistently reflects the app's version, as shown in the provided examples linking 'av' values to specific app identifiers and their versions. ```APIDOC Query Parameter: av Description: Represents the application version for requests. Examples: - av=7.0.1511 (from air.com.tutotoons.app.sweetbabygirlsummerfun2.free@7.0.1511) - av=8.0.20007 (from com.tutotoons.app.jungleanimalhairsalon2.free@8.0.20007) - av=1.8.6 (from anime.art.paint.tap.color.by.number.free@1.8.6) - av=60.14.1 (from de.lotum.4pics1word@60.14.1) - av=7.7.1 (from com.studysmarter@7.7.1) Note: 'av' is likely an acronym for 'app version'. ``` -------------------------------- ### JWT Token Example Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/google/idToken.md An example of a JSON Web Token (JWT) used for authentication in the TrackHar project. This token contains claims about the authenticated user and session. ```jwt eyJhbGciOiJSUzI1NiIsImtpZCI6IjQ2NDExN2FjMzk2YmM3MWM4YzU5ZmI1MTlmMDEzZTJiNWJiNmM2ZTEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vaHVnLXByb2R1Y3Rpb24tOWRkZTMiLCJhdWQiOiJodWctcHJvZHVjdGlvbi05ZGRlMyIsImF1dGhfdGltZSI6MTY0ODY3ODMzMSwidXNlcl9pZCI6InlGWHJMckE2SXJYak1BRWhlRmFqbGw5dEJxSDIiLCJzdWIiOiJ5RlhyTHJBNklyWGpNQUVoZUZhamxsOXRCcUgyIiwiaWF0IjoxNjQ4Njc4MzMxLCJleHAiOjE2NDg2ODE5MzEsImVtYWlsIjoiM2ZiZDI5OTctNjJkNS00MTEzLTk1MjEtZGZiOTM3MjlkMzM5X2EzY2Y0N2E5YmIxODRjOGRAYXBwdGl2YXRlLml0IiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJmaXJlYmFzZSI6eyJpZGVudGl0aWVzIjp7ImVtYWlsIjpbIjNmYmQyOTk3LTYyZDUtNDExMy05NTIxLWRmYjkzNzI5ZDMzOV9hM2NmNDdhOWJiMTg0YzhkQGFwcHRpdmF0ZS5pdCJdfSwic2lnbl9pbl9wcm92aWRlciI6InBhc3N3b3JkIn19.cjp4uyKf_aAhw4FdUt4u6dSs1O5mwyiitNUeIbdHFLYZ4L85hJJjxus4nvbLeHBz5nKAtkng0EITj6XwaUtrXmEWLtbpTVPJNo5C8YP-SUzxWeEKSlhWeF_pJo7saBpBCXxnukf7EQG7F7TW0qqEkqJyrM4y0ApLEO9z8l-3Rpuc1fO24VxML5xjxtYwkhftUDVdvnNaHwCexKw0HmS9cSYT_ey1sCxbLFldYgh0XYJ_R-UoGopSiAfaXtzbJpVwT5eYkXI_IEZyNB2UEVoO-f8Pg2WdnNPwFCGXLZeIPv5o_epaYAtUeLh7vN0aFN1jxVGyirJ9t8hY_5GaQky6Pw ``` -------------------------------- ### Decoded Firebase Installation ID Token Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/google/appInstanceIdToken.md The decoded payload of the Firebase JWT token, revealing claims such as appId, expiration time (exp), Firebase Installation ID (fid), and projectNumber. ```json { "appId": "1:1065473598624:android:d7820756c5c808db03d5c5", "exp": 1715006700, "fid": "edxIno8fTf6X4y_K5Z615P", "projectNumber": 1065473598624 } ``` -------------------------------- ### Advertising Identifier Format and Examples Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/infonline/client.uuids.advertisingIdentifier.md The `client.uuids.advertisingIdentifier` property represents the MD5 hash of a device's advertising ID (Google Advertising ID or Apple IDFA), with all zero characters removed from the hash. This section provides examples of observed values and their corresponding original Ad IDs. ```APIDOC client.uuids.advertisingIdentifier: Description: MD5 hash of the device's Google advertising ID or Apple IDFA, with all '0' characters removed. Observed Values: - `ead12c883812cadaf46f99793f2d824` - `ab9930d110c818f66934e6d39e4e7` - `7bbcc33bb8b6426f75a8fb06a5cbb83b` - `53cc56dda0de1669b258c9edd23349` Mapping to Ad IDs: - Ad ID: `827d8162-0e1c-48cd-892e-4abd3df95ba8` -> MD5 hash: `ea0d12c883812cadaf46f99793f2d824` - Ad ID: `ea70edc1-ac05-481c-8d2a-66b1be496a7e` -> MD5 hash: `ab9930d1100c818f669304e60d39e4e7` - Ad ID: `fffe8a97-a504-4d14-89ab-c2025fbaf065` -> MD5 hash: `53cc56dda0de1669b2580c9edd233409` - Ad ID: `F04C6D92-D4FA-4CA4-AC62-DE94C8C2DAE7` -> MD5 hash: `7bbcc33bb8b6426f75a8fb06a5cbb83b` ``` -------------------------------- ### Request Type Definition Source: https://github.com/tweaselorg/trackhar/blob/main/docs/README.md Defines the 'Request' type, representing an internal representation of an HTTP request. It includes properties for content, cookies, endpoint URL, headers, host, HTTP version, method, path, port, scheme, and start time. ```typescript Ƭ **Request**: `Object` Our internal representation of an HTTP request. #### Type declaration | Name | Type | Description | | :------ | | `content?` | `string` | The request body, if any. | | `cookies?` | { `name`: `string` ; `value`: `string` }[] | The cookies set through request. | | `endpointUrl` | `string` | The full URL, but without the query string. This is useful for matching in the adapters. | | `headers?` | { `name`: `string` ; `value`: `string` }[] | The headers included in the request. | | `host` | `string` | The host name of the request. | | `httpVersion` | `string` | The HTTP version of the request. | | `method` | `string` | The HTTP method used. | | `path` | `string` | The full path of the request, including the query string. | | `port` | `string` | The port of the request. | | `scheme` | ``"http"`` | ``"https"`` | The scheme of the request. | | `startTime` | `Date` | The time when the request was sent. | #### Defined in [common/request.ts:4](https://github.com/tweaselORG/TrackHAR/blob/main/src/common/request.ts#L4) ``` -------------------------------- ### Resettable Device Identifiers (RDIDs) in Ad Manager Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/google/rdid.md This section details the 'rdid' property as a resettable device identifier according to Google Ad Manager documentation. It lists various examples of RDIDs across different platforms. ```APIDOC Targeting Parameter Documentation (Google Ad Manager): rdid property: A resettable device identifier. Resettable Device Identifiers (RDIDs) Examples: - Google AdID - Apple IDFA - Amazon AFAI - Roku RIDA - Xbox MSAI ``` -------------------------------- ### Facebook Graph API Application Activities Reference Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/facebook/anon_id.md Documentation for the Facebook Graph API's application activities endpoint, specifically detailing the 'anon_id' property. This property is described as the ID of a person who has installed the app anonymously, but its implications under GDPR are discussed. ```apidoc Facebook Graph API - Application Activities (v17.0) Endpoint: /v17.0/{application-id}/activities Description: Retrieves activities associated with an application. Properties: anon_id: The ID of a person who has installed the app anonymously. Note: While termed 'anonymous', this ID may be considered personal data under GDPR. ``` -------------------------------- ### Accessing Translations Source: https://github.com/tweaselorg/trackhar/blob/main/README.md Demonstrates how to import and use translation files provided by the trackhar library. These files contain human-readable descriptions for standardized property names and introductory descriptions for trackers and adapters, supporting internationalization. ```ts import translationsEn from 'trackhar/i18n/en.json'; console.log(translationsEn.properties.diskTotal); // => "Total disk space" console.log(translationsEn['tracker-descriptions'].adjust); // => "Adjust offers the following services: […]" ``` -------------------------------- ### Debugging an Adapter Source: https://github.com/tweaselorg/trackhar/blob/main/README.md Command to run the adapter debugging script against a specific tracker and adapter. This helps test adapters against a database of real requests. ```sh yarn debug-adapter / # e.g.: yarn debug-adapter facebook/graph ``` -------------------------------- ### Android SDK: Get Carrier Name Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/onesignal/carrier.md Demonstrates how the OneSignal Android SDK retrieves the carrier name using TelephonyManager. It calls `osUtils.getCarrierName()`, which in turn uses `TelephonyManager.getNetworkOperatorName()` to get the carrier's name. Includes error handling for potential exceptions. ```java deviceInfo.put("carrier", osUtils.getCarrierName()); ``` ```java String getCarrierName() { try { TelephonyManager manager = (TelephonyManager) OneSignal.appContext.getSystemService(Context.TELEPHONY_SERVICE); // May throw even though it's not in noted in the Android docs. // Issue #427 String carrierName = manager.getNetworkOperatorName(); return "".equals(carrierName) ? null : carrierName; } catch(Throwable t) { t.printStackTrace(); return null; } } ``` -------------------------------- ### TrackHAR API Reference Source: https://github.com/tweaselorg/trackhar/blob/main/README.md Provides a link to the full API reference documentation for the TrackHAR library, located in the 'docs' folder. ```APIDOC TrackHAR API Reference: Location: /docs/README.md Description: Contains detailed information about all available functions, classes, and modules within the TrackHAR library, including usage examples and parameter explanations. ``` -------------------------------- ### adapters Variable Source: https://github.com/tweaselorg/trackhar/blob/main/docs/README.md An array containing all available adapters. Useful for advanced use cases and generating tracker wiki information. ```typescript • `Const` **adapters**: [`Adapter`](README.md#adapter)[] = `allAdapters` ``` -------------------------------- ### Android SDK Version Property Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/onesignal/sdk.md Demonstrates how the SDK version is set in the OneSignal Android SDK. It shows the 'sdk' property being assigned the static 'VERSION' constant. ```java deviceInfo.put("sdk", VERSION); ``` ```java private static final String VERSION = "040806"; public static String getSdkVersionRaw() { return VERSION; } ``` -------------------------------- ### Android SDK: Anonymous ID Generation Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/facebook/anon_id.md This snippet illustrates the anonymous ID generation in the Facebook SDK for Android. It retrieves or generates a GUID, prepends 'XZ', and stores it in SharedPreferences. The process is similar to the iOS SDK. ```kt /** * Each app/device pair gets an GUID that is sent back with App Events and persisted with this * app/device pair. * * @param context The application context. * @return The GUID for this app/device pair. */ @JvmStatic fun getAnonymousAppDeviceGUID(context: Context): String { return AppEventsLoggerImpl.getAnonymousAppDeviceGUID(context) } ``` ```kt @JvmStatic fun getAnonymousAppDeviceGUID(context: Context): String { if (anonymousAppDeviceGUID == null) { synchronized(staticLock) { if (anonymousAppDeviceGUID == null) { val preferences = context.getSharedPreferences(APP_EVENT_PREFERENCES, Context.MODE_PRIVATE) anonymousAppDeviceGUID = preferences.getString("anonymousAppDeviceGUID", null) ``` ```java Utility.setAppEventAttributionParameters( deferredApplinkParams, AttributionIdentifiers.getAttributionIdentifiers(context), AppEventsLogger.getAnonymousAppDeviceGUID(context), FacebookSdk.getLimitEventAndDataUsage(context), context); ``` ```kt params.put("anon_id", anonymousAppDeviceGUID) ``` -------------------------------- ### TrackHAR API Documentation Source: https://github.com/tweaselorg/trackhar/blob/main/docs/README.md This section details the core functions and types used within the TrackHAR project. It includes the `Request` object structure, the `process` function for handling requests with optional indicators, and the `unhar` function for HAR file parsing. ```apidoc Request: # Represents an internal request object. # Properties include details about the request's origin, headers, body, etc. # See README.md#request for full details. Options: # Optional configuration object for the process function. indicatorValues?: Partial, ArrayOrSingle >; process(request: Request, options?: Options): undefined | AnnotatedResult; # Processes a request with optional indicator values for enhanced matching. # Defined in: src/index.ts:305 unhar(har: Har): Request[]; # Parses a HAR traffic dump into an array of internal Request objects. # Parameters: # har: The HAR traffic dump. # Returns: # An array of Request objects. # Defined in: src/common/request.ts:34 ``` -------------------------------- ### Android Version Code Extraction using aapt Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/google/vnm.md This snippet demonstrates how to extract the version code and version name from an Android application's APK using the 'aapt dump badging' command. It shows the output format, highlighting where the versionCode and versionName are located. ```sh $ aapt dump badging com.translate.talkingtranslator.apk package: name='com.translate.talkingtranslator' versionCode='140' versionName='2.3.9' compileSdkVersion='31' compileSdkVersionCodename='12' ``` ```sh $ aapt dump badging com.bravo.booster.apk package: name='com.bravo.booster' versionCode='43' versionName='1.3.0.1001' compileSdkVersion='31' compileSdkVersionCodename='12' ``` ```sh $ aapt dump badging com.paradyme.citysmash.apk package: name='com.paradyme.citysmash' versionCode='40' versionName='1.40' compileSdkVersion='30' compileSdkVersionCodename='11' ``` ```sh $ aapt dump badging com.outdooractive.Outdooractive.apk package: name='com.outdooractive.Outdooractive' versionCode='2736704' versionName='3.9.0' compileSdkVersion='31' compileSdkVersionCodename='12' ``` ```sh $ aapt dump badging com.easybrain.block.puzzle.games/com.easybrain.block.puzzle.games.apk package: name='com.easybrain.block.puzzle.games' versionCode='2070010' versionName='2.7.0' compileSdkVersion='31' compileSdkVersionCodename='12' ``` -------------------------------- ### Generate Anonymous App Device GUID Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/facebook/anon_id.md Generates and stores a unique anonymous device identifier if one does not already exist. This identifier is prefixed with 'XZ' to distinguish it from other identifiers. It uses Android's SharedPreferences for persistence. ```java if (anonymousAppDeviceGUID == null) { // Arbitrarily prepend XZ to distinguish from device supplied identifiers. anonymousAppDeviceGUID = "XZ" + UUID.randomUUID().toString() context .getSharedPreferences(APP_EVENT_PREFERENCES, Context.MODE_PRIVATE) .edit() .putString("anonymousAppDeviceGUID", anonymousAppDeviceGUID) .apply() } return checkNotNull(anonymousAppDeviceGUID) ``` -------------------------------- ### Retrieving Bundle Identifier in OneSignal SDK Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/onesignal/ios_bundle.md This Objective-C code snippet shows how the 'iOSBundle' property of the userState object is assigned the application's bundle identifier. It uses the NSBundle class to get the main bundle and then calls the bundleIdentifier method. ```objc userState.iOSBundle = [[NSBundle mainBundle] bundleIdentifier]; ``` -------------------------------- ### Hugo Leaf Bundle Structure Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/README.md Illustrates the typical folder structure for research documentation using Hugo leaf bundles, including index.md and section-specific Markdown files. ```markdown research-docs └── tracker-1 │ └── index.md │ └── gssid.md │ └── location-properties.md │ └── screenshot-1.png └── adapter-with-specific-research └── index.md └── section-1.md ``` -------------------------------- ### iOS SDK: Get Carrier Name Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/onesignal/carrier.md Illustrates how the OneSignal iOS SDK obtains the carrier name. It accesses the `carrier` property of the `OSUserState` class, which is populated by retrieving the `carrierName` from the `CTTelephonyNetworkInfo` class's `subscriberCellularProvider`. This method is used to fetch the carrier's name from the device's cellular provider information. ```objective-c if (_carrier) dataDic[@"carrier"] = _carrier; ``` ```objective-c if (carrierName) userState.carrier = carrierName; ``` ```objective-c let CTTelephonyNetworkInfoClass = NSClassFromString(@"CTTelephonyNetworkInfo"); if (CTTelephonyNetworkInfoClass) { id instance = [[CTTelephonyNetworkInfoClass alloc] init]; let carrierName = (NSString *)[[instance valueForKey:@"subscriberCellularProvider"] valueForKey:@"carrierName"]; // […] } ``` -------------------------------- ### Obtaining Package Name in OneSignal SDK Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/onesignal/android_package.md This code demonstrates how the `packageName` variable is populated by calling the `getPackageName()` method on the `appContext` object, which is an instance of `android.content.Context`. ```java String packageName = appContext.getPackageName(); ``` -------------------------------- ### adapterForRequest Function Source: https://github.com/tweaselorg/trackhar/blob/main/docs/README.md Finds the adapter that can handle a given request. Returns the adapter or undefined if none is found. ```typescript ▸ **adapterForRequest**(`r`): `undefined` | [`Adapter`](README.md#adapter) Find the adapter that can handle a certain request. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `r` | [`Request`](README.md#request) | The request to find an adapter for. | #### Returns `undefined` | [`Adapter`](README.md#adapter) The adapter that can handle the request, or `undefined` if none could be found. ``` -------------------------------- ### Adapter Type Definition Source: https://github.com/tweaselorg/trackhar/blob/main/docs/README.md Defines the structure of an Adapter, which contains instructions for extracting tracking data from requests. Adapters can handle specific endpoints and may involve multiple decoding steps. ```APIDOC Adapter: Type: Object Description: An adapter that contains instructions on how to extract the tracking data included in a request to certain endpoints. Handling for one endpoint might be split across multiple adapters if the endpoint accepts different request formats. The first adapter that matches a request will be used to decode it. Properties: containedDataPaths: Partial>> Description: A description of how to extract the transmitted tracking data from the decoded object. decodingSteps: DecodingStep[] Description: An array of the steps (in order) used to decode the request into an object format. description?: TrackerDescriptionTranslationKey Description: The translation key for a description that gives context on the endpoint, if that makes sense. endpointUrls: (string | RegExp)[] Description: The endpoints that this adapter can handle. Each entry can either be a string (which will have to be equal to the full endpoint URL in the request) or a regular expression that is matched against the endpoint URL. The endpoint URL in this context is the full URL, including protocol, host, and path, but excluding the query string. It should not have a trailing slash. match?: (r: Request) => boolean | undefined Description: An optional function to further filter which requests can be handled by this adapter. This is useful if there are multiple adapters for one endpoint that handle different request formats. name: string Description: A human-readable name for the adapter. This should be as close as possible to the official name for the endpoint. slug: string Description: A slug to identify the adapter. These only need to be unique per tracker, not globally. tracker: Tracker Description: The tracking company behind these endpoints. Defined in: index.ts:173 ``` -------------------------------- ### TrackHar Parameters Source: https://github.com/tweaselorg/trackhar/blob/main/docs/README.md Defines the parameters for processing HAR files. The `har` parameter accepts a HAR-formatted traffic dump. The optional `options` object allows for customization, including `valuesOnly` to simplify results by excluding metadata and `indicatorValues` for fallback matching using known honey data. ```APIDOC TrackHar: process(har: Har, options?: Object) Parameters: - har: Har - A traffic dump in HAR format. - options?: Object - An optional object to configure: - valuesOnly: boolean - If true, returns only values, excluding metadata. - indicatorValues: Partial, string>, ArrayOrSingle>> - Specifies known honey data values for certain properties for fallback matching. ``` -------------------------------- ### TrackHAR Decoding Functions API Source: https://github.com/tweaselorg/trackhar/blob/main/README.md Reference for predefined decoding functions available in TrackHAR, including their purpose and usage within `decodingSteps`. This section outlines the schema for `DecodingStep` objects and the expected parameters for functions. ```APIDOC DecodingStep: function: string - The name of the predefined decoding function (e.g., 'parseJson', 'getProperty', 'parseQueryString'). input: string (optional) - A path in the global decoding state to the input data for the function. mapInput: string (optional) - A path in the global decoding state to an array. The function will be mapped over each non-empty entry of this array. options: object (optional) - Additional options for the decoding function. The structure depends on the specific function (e.g., `{ path: 'propertyName' }` for `getProperty`). output: string - The path in the decoding state where the result of the function should be stored. Can be a variable name or a property access (e.g., 'res.body.propertyName'). Predefined Functions: - parseJson(input: string): object - Parses the input string as JSON. - parseQueryString(input: string): object - Parses the input string as a URL query string. - getProperty(input: object, options: { path: string }): any - Retrieves a property from an object using a specified path. ``` -------------------------------- ### Auto-Archiving Configuration Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/README.md Details the process for automatic archiving of URLs found in adapter reasoning using the 'yarn auto-archive' script, requiring an archive-config.json file for Internet Archive API credentials. ```javascript yarn auto-archive ``` -------------------------------- ### iOS SDK Version Property Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/onesignal/sdk.md Illustrates how the SDK version is set in the OneSignal iOS SDK. It shows the 'sdk' property of OSUserState being assigned the ONESIGNAL_VERSION constant. ```objective-c NSMutableDictionary *dataDic = [NSMutableDictionary dictionaryWithObjectsAndKeys: // … _sdk, @"sdk", nil]; ``` ```objective-c userState.sdk = ONESIGNAL_VERSION; ``` ```objective-c #define ONESIGNAL_VERSION @"031207" ``` -------------------------------- ### Web UUID Generation and Storage Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/adjust/uuid.md Explains how the Adjust SDK for web generates a `web_uuid` per subdomain and browser session. It is stored using IndexedDB or falls back to localStorage to identify unique web users. ```web Example: web_uuid=4d1615ab-ee78-49aa-a10f-d57035322a42 ``` -------------------------------- ### NSBundle Class Documentation Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/onesignal/ios_bundle.md Documentation for the NSBundle class and its methods related to accessing application information. ```APIDOC NSBundle: mainBundle - Returns the main application bundle. - Usage: [[NSBundle mainBundle]] bundleIdentifier - Returns the bundle's identifier string. - Usage: [bundleIdentifier] ``` -------------------------------- ### Tracker Type Definition Source: https://github.com/tweaselorg/trackhar/blob/main/docs/README.md Defines the 'Tracker' type, representing a tracking company for which adapters are available. It includes optional fields for datenanfragenSlug and exodusId, and required fields for description, name, and slug. ```typescript Ƭ **Tracker**: `Object` A tracking company that we have adapters for. #### Type declaration | Name | Type | Description | | :------ | :------ | :------ | | `datenanfragenSlug?` | `string` | The slug of the tracking company in the [Datenanfragen.de company database](https://www.datarequests.org/company) (if available). | | `description?` | [`TrackerDescriptionTranslationKey`](README.md#trackerdescriptiontranslationkey) | The translation key for an introductory description that gives context on the tracking company, if that makes sense and the description applies equally to all adapters assigned to the company. | | `exodusId?` | `number` | The numeric ID of the tracker in the [Exodus tracker database](https://reports.exodus-privacy.eu.org/en/trackers/) (if available). | | `name` | `string` | The legal name of the tracking company. | | `slug` | `string` | A slug to identify the tracker. | #### Defined in [index.ts:33](https://github.com/tweaselORG/TrackHAR/blob/main/src/index.ts#L33) ``` -------------------------------- ### DecodingStep Functions Source: https://github.com/tweaselorg/trackhar/blob/main/docs/README.md Defines the available functions for the DecodingStep, including parsing, decoding, and manipulation operations. Each function can take specific options. ```typescript type DecodingStep = | { function: "parseQueryString" | "parseJson" | "decodeBase64" | "decodeUrl" | "decodeProtobuf" | "decodeJwt" | "ensureArray" | "gunzip" } | { function: "split" ; options: { separator: string } } | { function: "getProperty" ; options: { path: JsonPath } } & { input: Path } | { mapInput: Path } & { output: Identifier } ``` -------------------------------- ### Tracker Metadata Definition Source: https://github.com/tweaselorg/trackhar/blob/main/README.md Defines the essential metadata for a tracker, including its slug, legal name, description, datenanfragenSlug, and exodusId. This information is crucial for organizing and identifying trackers within the TrackHar database. ```ts const tracker: Tracker = { slug: '', name: '', description: '', datenanfragenSlug: '', exodusId: 0 // ID of the tracker in the Exodus database }; ``` -------------------------------- ### TrackerDescriptionTranslationKey Type Source: https://github.com/tweaselorg/trackhar/blob/main/docs/README.md Defines a translation key for tracker descriptions, used for both Trackers and Adapters. Requires an English translation in i18n/en.json. ```typescript Ƭ **TrackerDescriptionTranslationKey**: keyof typeof `translations`[``"tracker-descriptions"``] ``` -------------------------------- ### Android Context Class Declaration Source: https://github.com/tweaselorg/trackhar/blob/main/research-docs/onesignal/android_package.md This snippet shows the declaration of the static `appContext` property, which is an instance of `android.content.Context`. This context is crucial for accessing application-specific information like the package name. ```java import android.content.Context; // … static Context appContext; ```