Running totals
Count every completed lesson, post or order toward a member's running total, from your platform or server.
Running totals
A daily streak asks "did you show up today?". A running total asks "how many have you done?". Every completed action adds one: 12 lessons, 30 posts, 5 orders. Running totals never expire, so members keep what they earn.
Both kinds count the same way. Your platform or server tells Streakfox a member finished the action, and the widget shows the new total.
Two names you'll see everywhere:
- Project key identifies your project. It's public and safe to put in a web page.
- Action is the thing you count, such as
lesson_completeorpost_created.
1) Count each action
Actions are counted after they happen, from a source the member can't fake. The browser never counts. Pick the path that fits your platform:
| Path | Best for | Guide |
|---|---|---|
| WordPress plugin | LearnDash lessons, approved member comments or your own server hook | WordPress |
| Incoming URL | Teachable, Thinkific, Circle and other platforms, via Zapier or Make | Course platforms |
| Webhook | Your own backend, n8n, Pipedream or anything that can send a POST | Events API |
Give every completion an ID
A running total counts every action, so a retried request must not count twice. Send an ID for each completion:
- Incoming URL. Map the lesson, post or order ID to
completion_id. - Webhook. Send it as
idempotencyKey, such aslesson_42:member_123. - WordPress. The plugin does this for you. Custom hooks pass
completion:YOUR_ID.
Each member and ID counts once. Without an ID, a retried webhook request can count again, and the incoming URL treats two actions from one member in the same minute as one.
curl -X POST https://api.streakfox.com/v1/webhook/YOUR_PROJECT_KEY/e \
-H "Content-Type: application/json" \
-H "X-Streak-Webhook-Secret: YOUR_WEBHOOK_SECRET" \
-d '{"event":"lesson_complete","userHash":"member_123","idempotencyKey":"lesson_42:member_123"}'2) Show the total
Add the widget to pages where members are signed in. It displays progress and doesn't count anything. Tell it whose total to show with the same member you count:
<script
src="https://cdn.streakfox.com/widget.js"
data-project="YOUR_PROJECT_KEY"
data-event="YOUR_ACTION"
data-member="MEMBER_EMAIL"
defer
></script>- Incoming URL. Use
data-memberwith your platform's member email variable. The course platform guide lists them. - Webhook. Use
data-user-hashwith the member ID you send asuserHash. - WordPress. The plugin adds the widget and the member for you.
data-member is for display only. It never reveals coupon codes or reward links. Those need a signed identity token.
3) Test, then go live
Until your program goes live, every action counts as a test. Complete the action once as a test member and watch Streakfox setup confirm their new total. Then go live.
Troubleshooting
| What you see | Fix |
|---|---|
| The total didn't move | Check that the action you send matches your program's action exactly. |
| One action counted twice | Send a stable completion_id or idempotencyKey for each completion. |
| Two real actions counted as one | They shared an ID, or reached the incoming URL with no ID in the same minute. |
| The widget shows a fresh total of 0 | The widget's member doesn't match the member you count. Use the same email or ID in both. |
403 SERVER_ACTION_REQUIRED | Something is counting from the browser. Move it to one of the paths in step 1. |
Next steps
- Course platforms, Zapier and Make
- Events API
- Connecting users for protected rewards