@innerworks-me/iw-mobile-auth
v1.1.1
Published
Capacitor plugin that help to retrieve metrics from mobile devices
Downloads
79
Maintainers
Readme
# Metrics Plugin
The `Metrics` plugin is a Capacitor-based solution designed to collect and retrieve essential metrics from mobile devices. This tool is particularly useful for applications requiring detailed analytics, diagnostics, and performance tracking. It integrates seamlessly into Ionic applications using Capacitor.
## Installation
Install the plugin with the following commands:
```bash
npm i @innerworks-me/iw-mobile-auth
npx cap sync
This ensures that the plugin is properly integrated into your Capacitor project.
API Overview
The plugin provides two primary methods for collecting and handling data:
API Documentation
textOnChange(...)
textOnChange(typing: any) => Promise<{}>
| Param | Type |
| ------------ | ---------------- |
| typing
| any |
Returns: Promise<{}>
setOptionalData(...)
setOptionalData(data: string) => Promise<{}>
| Param | Type |
| ------------ | ---------------- |
| data
| string|
Returns: Promise<{}>
sendCollectedData(...)
sendCollectedData(data: any) => Promise<{}>
| Param | Type |
| ---------- | ---------------- |
| data
| any |
Returns: Promise<{}>
Important Note: After calling the sendCollectedData()
function, data collection will be finalized, and any further metrics from textOnChange()
or setOptionalData()
will not be included in the payload.
Usage Examples
Monitoring Text Changes
To monitor text changes and handle input events:
import { Metrics } from '@innerworks-me/iw-mobile-auth';
Metrics.textOnChange({ typing: 'Hello, World!' })
Setting Optional Data
To set some optional data into payload, please use this function:
import { Metrics } from '@innerworks-me/iw-mobile-auth';
Metrics.setOptionalData({ data: 'Some optional data' })
Sending Collected Data
To send collected data with an associated social ID and project ID:
import { Metrics } from '@innerworks-me/iw-mobile-auth';
Metrics.sendCollectedData({
socialId: '12345',
projectId: 'ds012w1dk90kw209dks01'
})