analytics-plugin-rewardful
v0.2.9
Published
Rewardful plugin for Analytics
Maintainers
Readme
analytics-plugin-rewardful
Rewardful plugin for the Analytics library
This library exports the Rewardful plugin for the analytics package. It makes it easier to integrate Rewardful affiliate tracking with your analytics implementation.
Installation
pnpm install analytics analytics-plugin-rewardfulUsage
import Analytics from 'analytics'
import rewardfulPlugin from 'analytics-plugin-rewardful'
const analytics = Analytics({
app: 'awesome-app',
plugins: [
rewardfulPlugin({
apiKey: 'your-rewardful-api-key'
})
]
})Configuration
The plugin accepts a configuration object with the following options:
| Option | Type | Required | Description |
|--------|------|----------|-------------|
| apiKey | string | Yes | Your Rewardful API key |
Methods
conversion(email: string)
Track a conversion in Rewardful. This method should be called when a user completes a purchase or other conversion event.
// Track a conversion
analytics.plugins.rewardful.conversion('[email protected]')How it Works
This plugin:
- Injects the Rewardful preload script into your page
- Loads the Rewardful tracking script from
https://r.wdfl.co/rw.js - Provides methods to track conversions
The plugin is browser-only and will not execute in server-side environments.
API Reference
For more information on the Rewardful JavaScript API, see:
TypeScript
This plugin is written in TypeScript and includes type definitions.
