Sub topic 2
Collect your data and public competitor data
This chapter assumes you have analytics access to your own accounts, can work in a spreadsheet, and can read basic Python. The scripts use only the standard library.
Collect your own data
Export post-level data from each platform's native analytics. Keep one row per post, with the same columns for every account: post ID, platform, format, timestamp, followers at posting time, reach, likes, comments, shares, and saves.
Collect public competitor data
Use only information visible on public profiles without logging in. Follow each platform's terms of service, and collect only what the brand publishes. Use the same columns where you can see the values, leave blanks where you cannot, and record the date you collected each value.
Calculate engagement rate consistently
Use one formula for every account: (likes + comments + shares + saves) divided by followers at posting time.
| Post | Likes | Comments | Shares | Saves | Followers | Engagement rate |
|---|---|---|---|---|---|---|
| p001 | 420 | 35 | 60 | 90 | 12400 | 605 / 12400 = 4.88% |
Use the median rather than the average across posts, so one viral post does not distort the result.
import csv
from statistics import median
def engagement_rate(row):
interactions = sum(int(row[k]) for k in ("likes", "comments", "shares", "saves"))
followers = int(row["followers_at_post"])
return interactions / followers if followers else None
with open("posts.csv", newline="", encoding="utf-8") as f:
rows = list(csv.DictReader(f))
rates = [r for r in (engagement_rate(row) for row in rows) if r is not None]
if rates:
print(f"Posts: {len(rows)}, median engagement rate: {median(rates):.2%}")Review profiles and brand consistency
Check each profile against this list, and record yes or no for each item:
- Name, handle, and logo match across platforms.
- The bio states what the account offers and includes one call to action.
- The link works and points to a current page.
- Pinned posts or highlights show current, relevant content.
- Contact details are present and correct.
Analyze content mix and formats
Group posts by format and compare the median engagement rate for each. Also count the posts in each group. A format with three posts gives weak evidence.
from collections import defaultdict
by_format = defaultdict(list)
for row in rows:
rate = engagement_rate(row)
if rate is not None:
by_format[row["format"]].append(rate)
for fmt, values in sorted(by_format.items(), key=lambda kv: median(kv[1]), reverse=True):
print(f"{fmt}: {len(values)} posts, median {median(values):.2%}")This snippet continues from the script above and reuses rows and engagement_rate.
Analyze posting frequency and timing
Count posts per week for each account. Record the weekday and hour of each post, then compare median engagement rate by weekday. Treat small differences as noise until you have several months of data.
Exercise
Five of your posts have 300, 150, 80, 40, and 25 interactions. Each post had 10,000 followers at posting time. What is the median engagement rate?
Show answer
The rates are 3.00%, 1.50%, 0.80%, 0.40%, and 0.25%. Sorted, the middle value is 0.80%.