Battle of Fans
A head-to-head fan vote between football teams or players, with a countdown, a live split and a winner reveal.
A head-to-head fan vote between football teams or football players. While voting is open it shows a countdown, the sides with a Vote button each, and the vote split; once voting ends it announces the winner (or a draw) with the final result. A battle scheduled to open later counts down to its start. Optionally shows the match odds under the card.
<div data-component="fu-widget" data-content-type="battle-of-fans" data-content-id="your-poll-id"></div>Setting Up the Poll
A Battle of Fans is a poll with the type battle-of-fans, created in the Management Portal:
| Poll field | What it holds |
|---|---|
| Tags | The competing football teams or players, e.g. fb:t:8205 and fb:t:889 |
| Options | One option per side, in the same order as the tags. The first option and tag are the home side |
Custom field voting_starts_at | Optional. When voting opens, in ISO 8601 UTC. While the poll is inactive and this time is ahead, the widget counts down to it |
Custom field voting_ends_at | When voting closes, in ISO 8601 UTC, e.g. "2026-12-01T20:00:00Z". Without it there is no countdown |
| Title / description | The card's title and subtitle, unless data-battle-of-fans-labels overrides them |
Voting also closes when the poll is no longer active. Each user votes once.
You don't set the two custom fields by hand. The Management Portal writes them from the poll's Schedule: voting_starts_at is the earliest scheduled change to Active, and voting_ends_at the earliest scheduled change to Inactive or Expired. They update as soon as a task is created, changed or deleted, and are read-only in the poll's Custom fields.
Voting Start and End
| Moment | What the widget shows |
|---|---|
| Before the start | The poll is inactive and voting_starts_at is ahead: a "Voting starts in" countdown, and the sides with their Vote buttons disabled |
| The start time passes | "Voting starts soon". The widget reads the poll again every 15 seconds and opens voting as soon as the poll is active, without a reload |
| Still inactive 5 minutes after the start | The ended view |
| The end time passes | The widget reads the poll again and shows the winner (or a draw) with the final result, without a reload |
Names, logos, headshots and colours come from the tagged entities: a team uses its own branding colours, a player uses their club's. Sides without usable colours fall back to the theme, and a team without a logo shows its initials. With more than two tags the same layout extends to one column per side; on narrow screens the sides stack as rows.
Configuration Attributes
| Attribute | Description | Options/Format | Default |
|---|---|---|---|
data-content-id | Poll ID of a battle-of-fans poll | Poll ID string | Required |
data-battle-of-fans-progress-display | "bar" shows the split as a bar under the sides; "background" makes the sides' background the meter | "bar", "background" | "bar" |
data-battle-of-fans-show-results-before-vote | Show the split before the visitor votes. When "false" it stays hidden until they vote or voting ends | "true", "false" | true |
data-battle-of-fans-show-trophy | Show the trophy badge on the winner's image | "true", "false" | true |
data-battle-of-fans-trophy-position | Corner of the winner's image the badge sits on. Stays on that corner in right-to-left languages | "top-left", "top-right", "bottom-left", "bottom-right" | "bottom-right" |
data-battle-of-fans-labels | JSON object overriding any user-facing string — see Labels | '{"title":"Derby day","vote":"Pick"}' | Locale strings |
data-signin-cta-label | Sign-in button label, for a poll that requires registration | Any string | Translated default |
data-signin-cta-onclick | Sign-in action | JavaScript code | None |
data-signin-cta-url | Sign-in link URL | URL | None |
data-signin-cta-target | Sign-in link target | _self, _blank | None |
data-lead-fields | Lead form fields, for a poll with Auth Requirement LEAD | Comma-separated field names | Config default |
data-lead-position | "before" shows the form before voting; "after" once the visitor picks a side, casting the vote after the form | "before", "after" | "after" |
data-lead-sync-with-profile | Sync anonymous profiles to the database after the lead is submitted | "true", "false" | Config default |
data-campaign-id / data-campaign-name | Campaign the lead is recorded under | Any string | Config default |
Odds
| Attribute | Description | Options/Format | Default |
|---|---|---|---|
data-battle-of-fans-show-odds | Show the match odds under the card. Only for a battle between two teams | "true", "false" | false |
data-battle-of-fans-odds-event-id | The match the prices are for. No match, no odds | e.g. "fb:m:536871" | None |
data-battle-of-fans-odds-market | The market to show | See Odds Widget → Markets | "FT_1X2" |
data-battle-of-fans-odds-mode | "flash" alternates the operator logo and the prices instead of showing both | "default", "flash" | "default" |
data-battle-of-fans-odds-flash-interval | Flash interval in milliseconds. Ignored unless the mode is "flash" | Positive integer | 3000 |
data-battle-of-fans-odds-polling-interval | Odds poll interval in milliseconds | Positive integer | 30000 |
data-battle-of-fans-odds-operators | Comma-separated operator config ids, in preference order — the first that prices the market completely is shown | e.g. "betano-bg,efbet-bg" | First operator with prices |
data-battle-of-fans-odds-affiliate-id | Affiliate id substituted into every operator URL carrying an {affiliate_id} placeholder | Affiliate id string | None |
data-battle-of-fans-odds-affiliate-ids | JSON object of per-operator affiliate ids. Wins over data-battle-of-fans-odds-affiliate-id | e.g. '{"betano-bg":"aff-123"}' | None |
The strip shows only when the odds API returns prices for that match.
Per-element attributes override the global battleOfFans config field by field, including inside odds and labels.
Sign-in and Lead Collection
The poll's Auth Requirement in the Management Portal decides who can vote:
| Auth Requirement | Behaviour |
|---|---|
FREE | Anyone votes, signed in or not |
REGISTERED | Signed-out visitors see the sign-in CTA in place of the Vote buttons. A vote the API rejects with 401 or 403 switches to the same CTA |
LEAD | The lead form takes the sides' place, with the poll's lead title and description. A visitor who has already voted, or a poll that has ended, skips it |
PAID | Not supported. The Management Portal does not offer it for a Battle of Fans |
The lead form uses the same settings as every other widget — see Features → Lead Collection.
Labels
Every user-facing string falls back to the locale bundle and can be overridden per key through data-battle-of-fans-labels or battleOfFans.labels:
title, subtitle, votingEndsIn, votingStartsIn, votingStartsSoon, days, hours, minutes, seconds, vote, thankYou, voteToSeeResults, votingEnded, endedSubtitle, drawSubtitle, winner, ofTheVotes, finalResult.
title and subtitle default to the poll's own title and description; when the poll has none, the default subtitle differs for teams and players.
Callbacks
callbacks.onFinish in FuWidget.init() runs after a vote is cast, with the vote the API returned. It does not run for a visitor who had already voted. See Features → Callbacks.
Global Configuration
Set defaults for all Battle of Fans widgets in FuWidget.init():
FuWidget.init({
// ... other config
battleOfFans: {
progressDisplay: "background", // "bar" (default) or "background"
showResultsBeforeVote: false, // Optional: default true
showTrophy: true, // Optional: default true
trophyPosition: "top-right", // Optional: default "bottom-right"
labels: { vote: "Pick" }, // Optional: any key from Labels
showOdds: true, // Optional: default false
odds: {
eventId: "fb:m:536871", // The match the prices are for
market: "FT_1X2",
operators: ["betano-bg"],
},
},
});Examples
Background Fill, Results After the Vote
<div
data-component="fu-widget"
data-content-type="battle-of-fans"
data-content-id="your-poll-id"
data-battle-of-fans-progress-display="background"
data-battle-of-fans-show-results-before-vote="false"
></div>With Match Odds
<div
data-component="fu-widget"
data-content-type="battle-of-fans"
data-content-id="your-poll-id"
data-battle-of-fans-show-odds="true"
data-battle-of-fans-odds-event-id="fb:m:536871"
data-battle-of-fans-odds-operators="betano-bg"
></div>Lead Form Before Voting
<div
data-component="fu-widget"
data-content-type="battle-of-fans"
data-content-id="your-poll-id"
data-lead-fields="fullName,email"
data-lead-position="before"
></div>Features
- Two or more football teams or players, with their own names, images and colours
- Countdown to the start of a scheduled battle and to the end of voting, then a winner or draw reveal, all without a reload
- The split as a bar under the sides or as the sides' background
- One vote per user; returning voters see their pick
- Sign-in and lead-form gates driven by the poll's Auth Requirement
- Optional match odds for a battle between two teams
- Every string overridable
Updated 1 day ago
