recure
v3.0.8
Published
Recure tracking
Downloads
48
Maintainers
Readme
Recure.ai
Recure AI helps companies increase their revenue by detecting account sharers and free trial abusers and converting them into paying customers.
Quick start
First, run npm install recure
for your app.
Then, in your app put the code:
import { RecureAIClient } from 'recure/web';
import { EventType } from 'recure/web/enums';
// Put this code after successful submitted form sign_up/login
const recure = new RecureAIClient({ publicApiKey: 'your-public-api-key' });
await recure.track({
userOptions: { userId: 'userId', userEmail: '[email protected]' },
eventType: EventType.LOGIN,
});
Possible events in EventType
:
- LOGIN
- SIGN_UP
- PAGE
- FREE_TRIAL_STARTED
- FREE_TRIAL_ENDED
- SUBSCRIPTION_STARTED
- SUBSCRIPTION_ENDED
Note: If you use the PAGE
event, you also should put eventOption
as a 4-th parameter of the function.
import { RecureAIClient } from 'recure/web';
import { EventType } from 'recure/web/enums';
const recure = new RecureAIClient({ publicApiKey: 'your-public-api-key' });
await recure.track({
userOptions: { userId: 'userId', userEmail: 'example@email' },
eventType: EventType.PAGE,
eventOptions: { pageName: 'pageName' },
});
Notify the users
import { RecureAIClient } from 'recure/web';
import { EventType } from 'recure/web/enums';
const recure = new RecureAIClient({ privateApiKey: 'your-private-api-key' });
const flags = await recure.assess({
accountId: 'userId',
flag: FlagType.ACCOUNT_SHARER,
score: 0.1,
});
if (flags.includes(FlagType.ACCOUNT_SHARER)) {
// Based on your UI design, create a dialog for account sharing and open it
accountSharingDialog();
}
You may not indicate the score
parameter, by default it 0.6