The "Echo Chamber" Problem
Facebook's built-in analytics are great for self-reflection, but terrible for competition. You know your engagement rate is 2%, but is that good? If your competitor is getting 10%, you're failing.
In this guide, we'll build a Competitor Benchmarking Tool that:
- Scrapes the public posts of any Facebook Page.
- Calculates their "True Engagement Rate."
- Identifies which types of posts (Reels, Photos, Links) are working best for them.
The Tech Stack
We'll use the SociaVault API to access public page data.
Prerequisites
- Node.js installed
- A SociaVault API Key
axiosfor API requests
Exploring Facebook data options? See our Facebook API alternatives comparison.
Step 1: Fetching Page Posts
We need to get the last 20-30 posts to have a statistically significant sample.
const axios = require('axios');
const API_KEY = 'YOUR_SOCIAVAULT_API_KEY';
const BASE_URL = 'https://api.sociavault.com/v1/scrape/facebook';
async function getPagePosts(pageUrl) {
try {
console.log(`Fetching posts for ${pageUrl}...`);
const response = await axios.get(`${BASE_URL}/profile/posts`, {
params: { url: pageUrl },
headers: { 'x-api-key': API_KEY }
});
return response.data.data.items || [];
} catch (error) {
console.error('Error fetching posts:', error.response?.data || error.message);
return [];
}
}
Step 2: The Analysis Engine
We'll loop through the posts and aggregate the data.
function analyzePagePerformance(posts) {
const stats = {
totalPosts: posts.length,
totalLikes: 0,
totalComments: 0,
totalShares: 0,
byType: {}
};
posts.forEach(post => {
// Aggregate totals
stats.totalLikes += post.reaction_count || 0;
stats.totalComments += post.comment_count || 0;
stats.totalShares += post.share_count || 0;
// Categorize by type (Photo, Video, etc.)
const type = post.type || 'unknown';
if (!stats.byType[type]) {
stats.byType[type] = { count: 0, engagement: 0 };
}
stats.byType[type].count++;
stats.byType[type].engagement += (post.reaction_count + post.comment_count + post.share_count);
});
return stats;
}
Step 3: The Benchmark Report
Now, let's run it against a competitor and print the scorecard.
async function runBenchmark(pageUrl) {
const posts = await getPagePosts(pageUrl);
if (posts.length === 0) {
console.log("No posts found or page is private.");
return;
}
const data = analyzePagePerformance(posts);
const avgEngagement = Math.round((data.totalLikes + data.totalComments + data.totalShares) / data.totalPosts);
console.log(`\nš Competitor Scorecard`);
console.log(`----------------------------------------`);
console.log(`Posts Analyzed: ${data.totalPosts}`);
console.log(`Avg Engagement/Post: ${avgEngagement}`);
console.log(`Total Likes: ${data.totalLikes}`);
console.log(`Total Comments: ${data.totalComments}`);
console.log(`Total Shares: ${data.totalShares}`);
console.log(`\nš Best Content Types:`);
Object.keys(data.byType).forEach(type => {
const typeStats = data.byType[type];
const avg = Math.round(typeStats.engagement / typeStats.count);
console.log(`- ${type}: ${avg} avg engagement (${typeStats.count} posts)`);
});
}
// Example: Analyze a brand page
runBenchmark('https://www.facebook.com/RedBull');
Why This Matters in 2025
Facebook Reach is "pay-to-play" for most, but Reels and High-Quality Images still get organic distribution. By analyzing your competitors, you can see exactly where Facebook is giving them free reach, and pivot your strategy to match.
Next Steps
Stop posting into the void. Benchmark your performance today.
Found this helpful?
Share it with others who might benefit
Ready to Try SociaVault?
Start extracting social media data with our powerful API. No credit card required.