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 fieldWhat it holds
TagsThe competing football teams or players, e.g. fb:t:8205 and fb:t:889
OptionsOne option per side, in the same order as the tags. The first option and tag are the home side
Custom field voting_starts_atOptional. 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_atWhen voting closes, in ISO 8601 UTC, e.g. "2026-12-01T20:00:00Z". Without it there is no countdown
Title / descriptionThe 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

MomentWhat the widget shows
Before the startThe 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 startThe ended view
The end time passesThe 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

AttributeDescriptionOptions/FormatDefault
data-content-idPoll ID of a battle-of-fans pollPoll ID stringRequired
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-voteShow 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-trophyShow the trophy badge on the winner's image"true", "false"true
data-battle-of-fans-trophy-positionCorner 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-labelsJSON object overriding any user-facing string — see Labels'{"title":"Derby day","vote":"Pick"}'Locale strings
data-signin-cta-labelSign-in button label, for a poll that requires registrationAny stringTranslated default
data-signin-cta-onclickSign-in actionJavaScript codeNone
data-signin-cta-urlSign-in link URLURLNone
data-signin-cta-targetSign-in link target_self, _blankNone
data-lead-fieldsLead form fields, for a poll with Auth Requirement LEADComma-separated field namesConfig 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-profileSync anonymous profiles to the database after the lead is submitted"true", "false"Config default
data-campaign-id / data-campaign-nameCampaign the lead is recorded underAny stringConfig default

Odds

AttributeDescriptionOptions/FormatDefault
data-battle-of-fans-show-oddsShow the match odds under the card. Only for a battle between two teams"true", "false"false
data-battle-of-fans-odds-event-idThe match the prices are for. No match, no oddse.g. "fb:m:536871"None
data-battle-of-fans-odds-marketThe market to showSee 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-intervalFlash interval in milliseconds. Ignored unless the mode is "flash"Positive integer3000
data-battle-of-fans-odds-polling-intervalOdds poll interval in millisecondsPositive integer30000
data-battle-of-fans-odds-operatorsComma-separated operator config ids, in preference order — the first that prices the market completely is showne.g. "betano-bg,efbet-bg"First operator with prices
data-battle-of-fans-odds-affiliate-idAffiliate id substituted into every operator URL carrying an {affiliate_id} placeholderAffiliate id stringNone
data-battle-of-fans-odds-affiliate-idsJSON object of per-operator affiliate ids. Wins over data-battle-of-fans-odds-affiliate-ide.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 RequirementBehaviour
FREEAnyone votes, signed in or not
REGISTEREDSigned-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
LEADThe 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
PAIDNot 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
📘

Related (see the Features page): Lead Collection · Sign-in & Additional CTA · Callbacks · Authentication Requirements · Theming.


Did this page help you?