{"id":15435866,"url":"https://github.com/dldbdev/dldb_sdk_react_native","last_synced_at":"2026-01-19T19:33:47.420Z","repository":{"id":57336567,"uuid":"451855346","full_name":"dldbdev/dldb_sdk_react_native","owner":"dldbdev","description":"Behavioural analytics with the privacy by design","archived":false,"fork":false,"pushed_at":"2022-02-07T15:52:21.000Z","size":54066,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-11T10:33:07.895Z","etag":null,"topics":["android","app-analytics","appanalytics","data-analytics","flutter","gdpr","ios","privacy","python","react-native"],"latest_commit_sha":null,"homepage":"https://dldb.io/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dldbdev.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-25T11:45:59.000Z","updated_at":"2022-02-08T12:23:05.000Z","dependencies_parsed_at":"2022-09-03T07:20:57.582Z","dependency_job_id":null,"html_url":"https://github.com/dldbdev/dldb_sdk_react_native","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dldbdev/dldb_sdk_react_native","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dldbdev%2Fdldb_sdk_react_native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dldbdev%2Fdldb_sdk_react_native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dldbdev%2Fdldb_sdk_react_native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dldbdev%2Fdldb_sdk_react_native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dldbdev","download_url":"https://codeload.github.com/dldbdev/dldb_sdk_react_native/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dldbdev%2Fdldb_sdk_react_native/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28581643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T19:06:42.549Z","status":"ssl_error","status_checked_at":"2026-01-19T19:06:42.040Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","app-analytics","appanalytics","data-analytics","flutter","gdpr","ios","privacy","python","react-native"],"created_at":"2024-10-01T18:46:41.693Z","updated_at":"2026-01-19T19:33:47.399Z","avatar_url":"https://github.com/dldbdev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DLDB React Native\n\nWelcom to the DLDB SDK beta for react native\n\n- [Installation](#Installation)\n- [Getting started](#getting-started)\n- [Api and examples](#api-and-examples)\n- [About DLDB](#about-dldb)\n- [Support and contacts](#support-and-contacts)\n\n## Installation\n\n`$ npm install react-native-dldb --save`\n`$ cd ios \u0026\u0026 pod install \u0026\u0026 cd ..`\n\n## Getting started\n\n```javascript\nimport dldb from 'react-native-dldb';\n\n...\n// at app start, after user consent\ndldb.init(\n    '11111111-1111-1111-1111-111111111111',\n    '{\"button\" : \"t\",\"batteryLevel\" : \"i\"}'\n    );\n...\n// once per day\ndldb.heartbeat();\n...\n// on a very regular basis, when app idle ?\ndldb.runQueriesIfAny();\n...\n// wherever useful\ndldb.addEvents('{\"button\":\"log in\", \"batteryLevel\" : 55 }');\n// location and event\ndldb.addEventsWithLocation(\n    '{\"batteryLevel\" : 5 }',\n    {latitude : 45.0, longitude : 0.0, accuracy : 20}\n    );\n// location only\ndldb.addLocation(\n    {latitude : 45.0, longitude : 0.0, accuracy : 20}\n    );\n```\n\n## Api and examples\n  - [init](#init)\n  - [heartbeat](#heartbeat)\n  - [runQueriesIfAny](#runqueriesifany)\n  - [addEventsWithLocation](#addeventswithlocation)\n  - [addEvents](#addevents)\n  - [addLocation](#addlocation)\n  - [queriesLog](#querieslog)\n  - [locationsLog](#locationslog)\n  - [close](#close)\n\n### init\n\nInitialize the DLDB SDK with the dldbApiKey and events dictionary.\u003cbr/\u003e\nThe dldbApiKey is required and can be obtained from the  [DLDB dashboard](https://dashboard.dldb.io).\u003cbr/\u003e\n\n| parameter    | type     | description                               |\n| -----------  |----------|------------------------------------------ |\n| dldbApiKey   | string   | dpi key                                   |\n| eventsDictionaryAsJson  | string | set of (event name, event type) as json |\n\nThe events dictionary is a json string containing one object per event. Each object defines the event name as a key and the values as the type of events : 't' for text, 'i' for numeric value.\nA dictionary `{ \"button\" : \"t\", \"batteryLevel\": \"i\" }` defines 2 events : `button` with text value, and `batteryLevel` with numeric value.\nThe dictionary is meant to be a constant and can be changed only with new versions of your app.\nThe event names defined in this dictionary will the only events accepted by the functions [addEvents](#addEvents) and [addEventsWithLocation](#addEventsWithLocation)\n\n\n*Example:*\n\n```javascript\n\ndldb.init(\n    '11111111-1111-1111-1111-111111111111',\n    '{\"button\" : \"t\",\"batteryLevel\" : \"i\"}'\n    );\n```\n\n### heartbeat\n\nto be called on a low frequency basis compatible with the app usage frequency, in order to provide accurate estimates of query response time to the dashboard.\n\n*Example:*\n\n```javascript\ndldb.heartbeat();\n```\n\n### runQueriesIfAny\n\nto be called on a regular basis compatible with the app usage frequency, in order to provide fast query responses to the dashboard. The more often it is called the faster the queries will be replied on dashboard\n\n*Example:*\n\n```javascript\ndldb.runQueriesIfAny();\n```\n\n### addEventsWithLocation\n\n| parameter    | type     | description                                   |\n| -----------  |----------|------------------------------------------     |\n| eventsAsJson | string   | The name and values of the events             |\n| location     | object   | the location of the events                    |\n\nEvents `eventsAsJson` can be any metric or KPI relevant for better understanding of end-user behaviour. All events provided through this call will be attached to the same second. If you do not have access to the location when this function is called, use [addEvents](#addEvents)\nEvent names must be present in the dictionary provided when calling [init](#init). Events with unknown names will be discarded.\nThe events will be attached to exactly the same instant, which will be the current second when the function is called, relying on device clock and time zone information.\n\n`location` indicates where the events is happening.\n\n| Property  | Description   |\n| --------  | ------------- |\n| latitude  | in decimal degrees  |\n| longitude | in decimal degrees  |\n| accuracy  | horizontal accuracy in meters aka the radius of the area, defaults to 100m if not present |\n\n`longitude` and `latitude` are taken into account if both are present and valid values.\n\n*Example:*\n\n```javascript\n// location and event\ndldb.addEventsWithLocation(\n    '{\"batteryLevel\" : 5 }',\n    {latitude : 45.0, longitude : 0.0, accuracy : 20}\n    );\n...\n```\n\n### addEvents\n\n| parameter    | type     | description                                   |\n| -----------  |----------|------------------------------------------     |\n| eventsAsJson | string   | The name and values of the events             |\n\nEvents `eventsAsJson` can be any metric or KPI relevant for better understanding of end-user behaviour. All events provided through this call will be attached to the same second. If you do have access to the location when this function is called, use [addEventsWithLocation](#addEventsWithLocation)\nEvent names must be present in the dictionary provided when calling [init](#init). Events with unknown names will be discarded.\nThe events will be attached to exactly the same instant, which will be the current second when the function is called, relying on device clock and time zone information.\n\n*Example:*\n\n```javascript\n\ndldb.addEvents('{\"button\":\"log in\", \"batteryLevel\" : 55 }');\n...\ndldb.addEvents('{\"batteryLevel\" : 5 }');\n...\n```\n\n### addLocation\n\n| parameter    | type     | description                                   |\n| -----------  |----------|------------------------------------------     |\n| location     | object   | the location of the events                    |\n\n`location` indicates where the events is happening.\n\n| Property  | Description   |\n| --------  | ------------- |\n| latitude  | in decimal degrees  |\n| longitude | in decimal degrees  |\n| accuracy  | horizontal accuracy in meters aka the radius of the area, defaults to 100m if not present |\n\n`longitude` and `latitude` are taken into account if both are present and valid values.\n\n*Example:*\n\n```javascript\ndldb.addLocation(\n    {latitude : 45.0, longitude : 0.0, accuracy : 20}\n    );\n...\n```\n\n### queriesLog\n\n| parameter    | type     | description                                   |\n| -----------  |----------|------------------------------------------     |\n| maxEntries   | number   | the max number of entries to include in the log |\n\nreturn a promise to the log of `maxEntries` most recent queries ran on the device.\n\nThe log is a json array (most recent last) of json objects, each object representing a query ran on the device\n\n| Property  | Description   |\n| --------  | ------------- |\n| id        | uuid of query  |\n| type      | type of query  |\n| fetched   | timestamp in ms when the query was fetched from server |\n| answered  | timestamp in ms when the query was answered on the device  |\n| finished  | timestamp in ms when the query was finished on the device |\n| tries     | number of tries to run the query |\n| json_in   | parameters of the query |\n| json_out  | results of the query |\n\n*Example:*\n\n```javascript\n\nonQueriesLog = async () =\u003e {\n    try {\n        const queriesLog = await dldb.queriesLog(5);\n        console.log(`Got the queries log ${queriesLog}`);\n        this.setState({\n                status: 'DLDB queries log',\n                message: queriesLog\n            });\n        } catch (e) {\n            console.error(e);\n    }\n}\n\n\u003cButton onPress={onQueriesLog} title=\"Queries log\"\u003e\n\n...\n```\n\n### locationsLog\n\n| parameter    | type     | description                                   |\n| -----------  |----------|------------------------------------------     |\n| durationInSeconds | number   | how far back in the past to look for locations |\n| maxEntries   | number   | the max number of entries to include in the log |\n| resolution   | number   | resolution of returned locations |\n\nreturn a promise to the log of at most `maxEntries` most recent unique locations stored on the device during the last `durationInSeconds`.\n\nThe log is a json array (most recent last) of [h3](https://h3geo.org) in hex string format, at resolution `resolution`.\nA call to this function generates an entry into the queries log.\n\n*Example:*\n\n```javascript\n\nonLocationsLog = async () =\u003e {\n    try {\n        const locationsLog = await dldb.locationsLog(5);\n        console.log(`Got the locations log ${locationsLog}`);\n        this.setState({\n                status: 'DLDB locations log',\n                message: locationsLog\n            });\n        } catch (e) {\n            console.error(e);\n    }\n}\n\n\u003cButton onPress={onLocationsLog} title=\"Locations log\"\u003e\n\n...\n```\n\n### close\n\nto be called when shutting down the app.\n\n*Example:*\n\n```javascript\ndldb.close();\n```\n\n## About DLDB\n\nDLDB provides behavioural analytics for mobile applications with privacy by design.\n\nDLDB architecture relies on an SDK to be integrated into your mobile application, and a dashboard https://dashboard.dldb.io/ to build, query, analyze the behaviour of your application users.\n\nFor your application, DLDB deploys a distributed database, where each database instance is inside the mobile application scope. All the analytics queries are run by the devices and no raw data ever leaves the devices. Only the statistical KPI-s are sent anonymously to the DLDB dashboard .\n\nFrom the DLDB dashboard, developers, analysts and app owners can build their own queries and analyze the results. No need to have any additional storage or analytics platform: DLDB provides an end-to-end solution.\n\nDLDB SDK is written in C and has bindings to most common languages - works natively on iOS, Android, React-Native and Flutter. We also have Python binding and C libraries for IoT devices.\n\n### Highlights\n\n- Seamless integration of DLDB SDK into your mobile app source base, in many flavours, on all major platforms\n- Define your own schema of collected events and values\n- Built-in GDPR compliance on the right to be forgottent: all data belonging to your user stays on the device, so delete the data whenever requested\n- Built-in GDPR compliance on the traceability of data usage: all requests processed by the DLDB SDK are traced and can be shown on demand\n- No additional online storage\n- Rapid scaling\n\n## Support and contacts\n\nIf you face any problems or have any questions, please contact us\n\nsupport channel in Discord: https://discord.gg/TD4f6p6nUH\n\nemail: support@dldb.io \n\nweb: https://dldb.io/\n\nsubscribe for product updates and news: https://dldb.io/#Beta\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdldbdev%2Fdldb_sdk_react_native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdldbdev%2Fdldb_sdk_react_native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdldbdev%2Fdldb_sdk_react_native/lists"}