Untitled

 avatar
unknown
plain_text
a year ago
526 B
8
Indexable
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;
  }
};
Editor is loading...
Leave a Comment