Meta App Events
Updated
Send installs and purchases to Meta for ad attribution.
- JavaScript:
window.AppSorcerer.meta - Plan: Plus (premium) — included on plans with premium plugins, and you can try it free for 14 days
- Platforms: Android apps today. iOS support arrives with iOS builds (coming soon).
Turn the plugin on in App Studio → Plugins, fill in its settings, then rebuild your app. Websites call it through the JavaScript bridge.
Settings
| Studio label | Type | Default | Notes |
|---|---|---|---|
| Meta App ID | text | – | required |
| Client token | text | – | required |
| Log app events automatically | toggle | true |
Setup
Enter the Meta App ID (digits only) and Client token from Meta for Developers → App settings → Advanced.
JavaScript API
Every method returns a Promise. Call it as await AppSorcerer.meta.<method>(args).
| Method | Arguments | Notes |
|---|---|---|
logEvent | { name, valueToSum?, params? } | Friendly names map to Meta standard events: ViewContent, Search, AddToCart, AddToWishlist, InitiateCheckout, AddPaymentInfo, CompleteRegistration, Purchase, Rate, Subscribe, StartTrial, Contact. Friendly param keys map too (currency → fb_currency, contentId → fb_content_id, contentType, content, numItems, searchString, description, orderId, registrationMethod, paymentInfoAvailable, success, maxRatingValue, level) |
logPurchase | { amount, currency = 'USD', params? } | |
setUserId / clearUserId | { userId } | |
setUserData | { email, firstName, lastName, phone, dateOfBirth, gender, city, state, zip, country } | Advanced matching (hashed by the SDK) |
clearUserData | – | |
flush | – | Sends queued events now |
setAutoLogEvents | { enabled } | |
setAdvertiserIdCollection | { enabled } |
Errors
Rejections carry error.code: not_configured, invalid_args, meta_error, unknown_method.
Example
JavaScript
await AppSorcerer.meta.logEvent({ name: 'AddToCart', valueToSum: 29.9, params: { currency: 'EUR', contentId: 'SKU-1' } });
await AppSorcerer.meta.logPurchase({ amount: 59.8, currency: 'EUR', params: { orderId: '1042' } });Notes
- Log app events automatically covers installs, app launches and Google Play purchases.
- With an empty App ID, calls reject with
not_configured.
Was this helpful?