Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
526 B
5
Indexable
Never
import FB from 'fb';

FB.options({
  version: 'v14.0', // Make sure to use the latest version
  accessToken: process.env.REACT_APP_FACEBOOK_ACCESS_TOKEN,
});

export const fetchMarketingData = async () => {
  try {
    const response = await FB.api('/your_ad_account_id/insights', 'GET', {
      fields: 'campaign_name,clicks,impressions,spend',
      // Define other parameters as needed
    });
    return response.data;
  } catch (error) {
    console.error('Error fetching marketing data:', error);
    throw error;
  }
};
Leave a Comment