Gift-guide season is peak season for TikTok creators, so this afternoon I pulled the latest videos under two hashtags, #giftsforher and #giftsforhim, and compared their views. The first number I got was a great headline. It was also wrong, and the reason it was wrong is a mistake that's easy to make with any social media data.
The first number
I used tiktok-hashtag-tracker, a small open-source script that saves the videos under a hashtag, with their views, likes, comments and shares, to a CSV:
git clone https://github.com/okdataapi/tiktok-hashtag-tracker cd tiktok-hashtag-tracker export OKDATA_API_KEY=your_key python3 tracker.py --hashtag giftsforher --hashtag giftsforhim --pages 3 --dry-run # shows the plan, spends nothing python3 tracker.py --hashtag giftsforher --hashtag giftsforhim --pages 3 Three pages per hashtag gave me 59 videos for #giftsforher and 60 for #giftsforhim, with no overlap between the two. Six API calls, $0.012 in total.
Keeping only videos posted in the last 30 days:
| Hashtag | Videos | Median views |
|---|---|---|
| #giftsforher | 47 | 1,846 |
| #giftsforhim | 53 | 106,362 |
That's a 58x gap. "Nobody knows what to buy men, so gift guides for him go viral" practically writes itself.
The column I almost didn't look at
Then I looked at the publish dates. 35 of the 47 #giftsforher videos were less than three days old. A TikTok video that went up yesterday hasn't had time to get views yet, so a list full of brand-new videos will always have a low median, whatever the topic.
So I split the videos by age:
import csv, statistics, sys from datetime import datetime rows = list(csv.DictReader(open(sys.argv[1], encoding="utf-8"))) run = datetime.fromisoformat(rows[0]["run_at"].replace("Z", "+00:00")) def age_days(r): pub = datetime.fromisoformat(r["published_at"].replace("Z", "+00:00")) return (run - pub).days buckets = [("0-2 days", 0, 2), ("3-6 days", 3, 6), ("7-30 days", 7, 30)] for tag in ("giftsforher", "giftsforhim"): vids = [r for r in rows if r["source"] == f"hashtag:{tag}" and age_days(r) <= 30] print(f"#{tag}: {len(vids)} videos from the last 30 days, " f"median views {statistics.median(int(r['views']) for r in vids):,.0f}") for name, lo, hi in buckets: b = [int(r["views"]) for r in vids if lo <= age_days(r) <= hi] if b: print(f" {name:>9}: {len(b):>2} videos, median {statistics.median(b):>9,.0f}") Output:
#giftsforher: 47 videos from the last 30 days, median views 1,846 0-2 days: 35 videos, median 1,116 3-6 days: 3 videos, median 2,060 7-30 days: 9 videos, median 277,778 #giftsforhim: 53 videos from the last 30 days, median views 106,362 0-2 days: 25 videos, median 1,663 3-6 days: 9 videos, median 157,756 7-30 days: 19 videos, median 296,006 Compare videos of the same age and the 58x gap mostly disappears:
- Videos 0-2 days old: 1,116 vs 1,663.
- Videos 7-30 days old: 277,778 vs 296,006, about 1.1x.
The headline gap came from the mix of ages in each list, not from the hashtags. #giftsforher had more fresh videos in it today, and fresh videos have low view counts.
(The 3-6 day bucket has only 3 #giftsforher videos, too few to read anything into.)
What I'd take from this
- Don't compare raw medians across hashtags, creators or time periods without checking the age of the posts. The same trap shows up when comparing a creator's last 10 videos against another's, or this week against last week.
- Bucket by age, or wait. The tracker appends to the same CSV each run, so running it again in a week lets you compare the same videos once they've had time to collect views. The report it prints on the second run lists the videos whose views grew the most.
- Sample sizes matter more after splitting. 9 and 19 videos per bucket is enough for a first look, not a conclusion.
For what it's worth, the most-viewed recent video in either list was a #giftsforhim post from November 16 with about 1.47 million views. The top #giftsforher one, a jumbo teddy bear ornament from November 13, had about 1.1 million. Pretty even.
Try it
The tracker is one Python file (there's a Node version too) with no dependencies. It takes hashtags and creator usernames, so you can also watch a set of competitors' accounts. The data comes from okdata, and new accounts get $0.10 of free credit, which covers this run many times over.
Written with AI assistance. I build okdata, the data API the script uses.