Full Stack / 4 min read
Sending Custom Ad Events to Meta in React Native with Expo
In a previous article, we discussed how to set up Meta ads with React Native using Expo. If you haven’t seen it yet, feel free to check it…
Sending Custom Ad Events to Meta in React Native with Expo

In a previous article, we discussed how to set up Meta ads with React Native using Expo. If you haven’t seen it yet, feel free to check it out here.
In this article, we’ll explore how to send custom events to Meta for tracking analytics.
Why Do We Need to Send Custom Events?
Let’s say you run an e-commerce store and want to track how many users who came through Meta ads made a purchase. In my case, I wanted to track: “How many users who came through Meta ads played our first game.”
Here’s how you can achieve that.
Step 1: Install the Required Library
You need to install the react-native-fbsdk-next library, which will allow you to interact with the Meta SDK.
You can install it using your preferred package manager:
npm install react-native-fbsdk-nextor
yarn add react-native-fbsdk-nextor
pnpm install react-native-fbsdk-nextStep 2: Initialize the SDK
Since we’ve already done Meta integration in a previous article, we’ll assume that you’ve integrated Meta according to that guide.
To initialize the Meta SDK in your App.ts file, add the following code:
import { Settings } from 'react-native-fbsdk-next';
import { useEffect } from 'react';
const App = () => {
useEffect(() => {
Settings.initializeSDK();
}, []);
}
export default App;Step 3: Define a Utility Function for Logging Events
To log custom events, define a utility function as follows:
import { AppEventsLogger } from 'react-native-fbsdk-next';
import { useCallback } from 'react';
export const logFacebookEvent = useCallback(
({ eventName, parameters = {} }: { eventName: string, parameters?: Record<string, string | number> }) => {
AppEventsLogger.logEvent(eventName, parameters);
}, []);Step 4: Use the logFacebookEvent Function to Send Events
You can now use the logFacebookEvent function whenever you want to send an event. Here’s an example for tracking an in-app purchase event:
logFacebookEvent({
eventName: 'first_in_app_purchase',
parameters: {
userId: 'user123',
amount: '19.99',
}
});Step 5: Track Only Meta Ads Users
To ensure that you only track users who came through Meta ads, you need to identify the source of the installation for each user. Check if the source is Meta ads before sending the event.
Step 6: Verify Your Custom Events
To verify your custom events:
- Log in to your Events Manager dashboard on Meta.
- In the dashboard, you’ll find an option to verify your custom events.
- Once verified, you’ll start receiving event data under Data Sources.
Step 7: Test Your Events
To test the events:
- Ensure that you are logged in with your Facebook account, which you use to generate ads, on the device you’re testing.
- Go to the Events Manager and navigate to Data Sources, where you’ll find the option to test events.
- Interact with your app, and your test events will appear on your Meta Event Manager dashboard.
For more details on testing events, refer to article, where I’ve explained how to test events in more detail.
This guide should help you send custom events to Meta for tracking purposes. By following these steps, you’ll be able to track analytics from users coming through Meta ads effectively.
Queries
Hope you have enjoyed reading it and learnt something new and valuable from this article today.
Now If you have any doubts or queries feel free to drop a comment or connect with me on my Topmate.
You can also reach out to me on my LinkedIn and follow me for updates on latest blogs.
Please do like this post if you enjoyed reading it.
Thanks for the read :)
Also, you can support me and my writings by treating me to a nice virtual cup of coffee ☕️