Server SDKs
Purchase Event
Send purchase events with the Node.js SDK
Track in-app purchases by sending a purchase event via the webhook endpoint.
Usage
import {
Client, UserData, PurchaseData, AppEvent
} from "@geeklab.app/audiencelab_nodejs_sdk";
const client = new Client({
apiKey: "YOUR_API_KEY",
baseUrl: "https://analytics.geeklab.app",
});
const userData = new UserData()
.setUserId("user_12345")
.setUserIp("203.0.113.42")
.setUserCreativeTokenInfo({
creativeToken: "abc123-creative-token",
os_system: "iOS 17.4",
device_name: "iPhone 14 Pro",
device_model: "iPhone15,2",
utc_offset: "+03:00",
install_date: "2026-06-09T10:00:00+00:00",
last_login_date: "2026-06-10T10:00:00+00:00",
total_purchase_value: 12.5,
total_ad_value: 1.25,
});
const purchase = new PurchaseData()
.setItemId("gems_pack_500")
.setItemName("500 Gems Pack")
.setValue(4.99)
.setCurrency("USD")
.setStatus("completed")
.setTransactionId("GPA.1234-5678-9012-34567")
.setDedupeKey("purchase_gems500_user12345");
const response = await new AppEvent(
client, purchase, userData
).send();PurchaseData Fields
Prop
Type