Skip to main content
Daily scores move around. Weekly averages show the trend. This recipe reads 90 days of visibility for one brand, groups the days into weeks starting on Monday, and prints the average visibility score, mention rate and share of voice per week, with the change from the week before.

What you need

How it works

  1. GET /projects/{project_id} returns the brand’s brand_name, the key its share of voice uses.
  2. GET /projects/{project_id}/visibility?from=…&to=… returns one point per tracked day. A range can span up to 366 days, so 90 days is one request with no pagination.
  3. The script averages each week’s points. Weeks only include days that had a tracking run.

Code

Expected output

The first and last weeks are partial, so compare full weeks when you report a trend.

Variations

share_of_voice holds every brand named in answers, not just yours. Sum each name’s share across the period and sort to see who gained ground.
Instead of polling, subscribe an endpoint to tracking.run.finalized and re-run this script when the event arrives. See Slack alerts from webhooks.
Page through GET /projects and run the loop per brand. Each brand takes two requests, well inside the 300-per-minute rate limit.
Last modified on November 18, 2026