Sdk
WordPress Plugin
Bring Streakfox widgets and analytics to WordPress sites.
There is no dedicated WordPress plugin yet, but you can ship streak mechanics today by embedding the widget script and triggering events from your theme or blocks.
1) Embed the widget script
Add the script tag in your theme (footer.php) or a Custom HTML block:
<script
src="https://cdn.streakfox.com/widget.js"
data-project="YOUR_PROJECT_ID"
data-event="visit"
data-position="bottom-right"
async
></script>2) Trigger events
Use window.streak() when users complete actions (likes, comments, purchases, etc.):
<script>
(function ready(cb) {
if (window.streak) return cb();
setTimeout(() => ready(cb), 25);
})(() => {
window.streak('comment');
});
</script>3) Link signed-in users
For logged-in visitors, generate an alias token on your server and POST it to /v1/alias so streaks follow users across devices. The Quickstart guide includes a working token example.
Recommended patterns
- Store your project ID in a theme option or environment variable.
- Trigger events from template hooks (e.g., after a form submit).
- Use server-side calls for sensitive actions (admin aliasing or server-driven events).