tiktokugccampaigns

TikTok UGC Campaign Tracking 2026

Track UGC campaigns via TikTok hashtag/videos endpoint. Daily pipeline returning engagement metrics at 1 credit per request. Alert on viral spikes.

8 min

Tracking UGC campaigns on TikTok means monitoring a hashtag for new videos, measuring engagement metrics across all campaign content, and alerting on viral spikes. The TikTok API hashtag/videos endpoint returns all videos under a campaign hashtag with engagement data. A daily pipeline at 1 credit per request catches new content and tracks performance trends.

Campaign tracking architecture

  1. Look up the campaign hashtag to get its ID
  2. Fetch all videos using that hashtag
  3. Calculate aggregate metrics: total views, avg engagement, top performers
  4. Compare against previous day to detect viral spikes
  5. Alert when a video exceeds 10x average engagement

Step 1: hashtag lookup and video collection

Python
import requests, os
from datetime import date

KEY = os.environ["SCAVIO_API_KEY"]
H = {"Authorization": f"Bearer {KEY}", "Content-Type": "application/json"}
BASE = "https://api.scavio.dev/api/v1/tiktok"

def get_campaign_videos(hashtag_name: str):
    """Get all videos under a campaign hashtag."""
    # Step 1: get hashtag ID
    hashtag = requests.post(f"{BASE}/hashtag",
        headers=H, json={"name": hashtag_name}).json()
    hashtag_id = hashtag.get("id")

    # Step 2: get videos under this hashtag
    videos = requests.post(f"{BASE}/hashtag/videos",
        headers=H, json={"hashtag_id": hashtag_id}).json()
    return [{
        "video_id": v.get("video_id"),
        "author": v.get("author", {}).get("unique_id", ""),
        "desc": v.get("desc", "")[:100],
        "views": v.get("play_count", 0),
        "likes": v.get("digg_count", 0),
        "comments": v.get("comment_count", 0),
        "shares": v.get("share_count", 0),
        "created": v.get("create_time"),
    } for v in videos.get("videos", [])]

# 2 API calls = $0.01 per check
videos = get_campaign_videos("YourBrandChallenge")
print(f"Found {len(videos)} campaign videos")

Step 2: aggregate metrics and detect viral content

Python
def campaign_report(videos: list):
    """Generate campaign performance report."""
    if not videos:
        return {"error": "no videos found"}
    total_views = sum(v["views"] for v in videos)
    total_engagement = sum(v["likes"] + v["comments"] + v["shares"] for v in videos)
    avg_views = total_views / len(videos)
    avg_engagement = total_engagement / len(videos)

    # Flag viral videos (10x above average)
    viral = [v for v in videos if v["views"] > avg_views * 10]

    # Top performers by engagement
    top_5 = sorted(videos, key=lambda v: v["likes"] + v["comments"], reverse=True)[:5]

    return {
        "date": date.today().isoformat(),
        "total_videos": len(videos),
        "total_views": total_views,
        "total_engagement": total_engagement,
        "avg_views": int(avg_views),
        "avg_engagement": int(avg_engagement),
        "viral_videos": len(viral),
        "top_5_creators": [v["author"] for v in top_5],
    }

report = campaign_report(videos)
print(f"Total views: {report['total_views']:,}")
print(f"Viral videos: {report['viral_videos']}")

Step 3: daily tracking and alerts

Python
import json

def daily_tracking(hashtag: str, history_file: str = "campaign_history.json"):
    """Run daily, compare against yesterday, alert on spikes."""
    videos = get_campaign_videos(hashtag)
    today_report = campaign_report(videos)

    # Load yesterday's data
    try:
        with open(history_file) as f:
            history = json.load(f)
        yesterday = history[-1] if history else None
    except FileNotFoundError:
        history = []
        yesterday = None

    # Detect changes
    if yesterday:
        new_videos = today_report["total_videos"] - yesterday["total_videos"]
        view_growth = today_report["total_views"] - yesterday["total_views"]
        today_report["new_videos_24h"] = new_videos
        today_report["view_growth_24h"] = view_growth

    history.append(today_report)
    with open(history_file, "w") as f:
        json.dump(history, f, indent=2)
    return today_report

# Daily cost: 2 API calls = $0.01/day = $0.30/mo
report = daily_tracking("YourBrandChallenge")

Cost for campaign tracking

  • Daily hashtag check: 2 API calls (hashtag lookup + videos) = $0.01/day
  • Monthly cost for one campaign: $0.30
  • 5 simultaneous campaigns: $1.50/mo
  • Compare: manual tracking (30 min/day of scrolling) or influencer platforms ($300+/mo)