fga-sdk-web
v1.1.7
Published
FGA SDK WEB
Readme
FGA SDK WEB
The Web SDK accompanying Footprint Analytics' FGA product facilitates effortless integration with Web2 data, such as user and event information.
Installation
npm install fga-sdk-webUsage
Simple usage example
// fgasdk.js
import FgaSDK from 'fga-sdk-web'
window.fgaSDK = new FgaSDK({
projectId: SDK_PROJECT_ID, token: SDK_TOKEN
});
window.fgaSDK.init()
// App.tsx
import "fgasdk.js"
// Page.tsx
window.fgaSDK.setUserProperties({
userId: "U1234567890",
userName: 'Jame',
})
window.fgaSDK.trackEvent({
eventType: "click",
eventName: "test_click_event",
})Advanced usage example
// fgasdk.js
import FgaSDK from 'fga-sdk-web'
window.fgaSDK = new FgaSDK({
projectId: SDK_PROJECT_ID, token: SDK_TOKEN
});
window.fgaSDK.init()
// App.tsx
import "fgasdk.js"
// Page.tsx
window.fgaSDK.setUserProperties({
userId: "U1234567890", // required
userName: 'Jame', // required
signUpDevice: 'Android Galaxy S21',
accountType: 'facebook',
idfa: 'A2B7C3D8-E1F2-G7H8-I2J6-K1L5M3N2O3P',
udId: '"12345678-1234-1234-1234-123456789012',
email: "[email protected]",
country: 'CAN',
ip: '192.168.1.100',
twitter: 'Jame',
discord: 'Jame#1234',
signUpAt: '1703980800',
})
window.fgaSDK.trackEvent({
eventType: "click", // required
eventName: "test_click_event", // required
eventId: 'ev123456789',
userId: 'U1234567890',
deviceId: 'd123456789',
region: 'USA',
eventDevice: 'Android Galaxy S21',
eventSource: 'home',
extraData: {
key1: 'value1',
key2: 'value2',
}
})Development
Installation
npm installPackage
npm run build:libPublish
npm run publish