How to integrate Comporta
Anyone who reaches a protected page without a pass is sent to the queue. When their turn comes, they return to your site with a single-use pass, which your site verifies on its own, without calling Comporta on every click. You do three things, once:
- 1
Create the room and mark the protected pages
In the dashboard, under Rooms › New room, enter the event name, when it opens, how many people per minute your site can handle and which pages go through the queue, for example
/eventos/show-x*(the asterisk matches everything that starts that way). Changed your mind? Change it in the dashboard, no new deploy.Under Site domains, enter your store address (e.g. www.yourticketing.com): it is where the queue sends visitors back to.
- 2
Connect your site
Pick one. For ticket sales, use Cloudflare or the server: the pass is checked before the page goes out. You can switch later without changing anything in the dashboard.
Cloudflare (no code changes)
Download the ready-made Worker from the dashboard (Integration › At the edge), paste it into the editor of a new Worker on Cloudflare and add the kit variables under Settings. Then, in your domain’s Workers Routes, point
your-store.com/*to it. Nothing to install.On the server
In any language: read the protected pages from
GET /v1/gate(10 s cache), send anyone without a pass tohttps://fila.comporta.app/r/SALA?t=URL_ATUAL, validate the JWT that comes back in?comporta=, redeem it once withPOST /v1/redeemand set a cookie. Specification and test cases insdk/spec.Browser only: one line (light protection)
<script src="https://fila.comporta.app/c.js" data-org="SUA_ORGANIZACAO"></script>
In the page header, no key or developer needed; works on WordPress, Shopify, Wix and any custom site. Protection runs in the browser: it organizes the honest crowd, but anyone who turns off JavaScript, uses a blocker or a bot gets straight in, and your server still renders the page on every visit. Good for measuring traffic and low-demand events; do not use it alone for high-demand sales.
The keys (Cloudflare and server) come ready in the dashboard: Integration › Generate connection kit. When the order is complete, free the spot for the next person in line (
leave; in the script,Comporta.leave('sala')). - 3
Test before the opening
The dashboard shows when your site first talked to Comporta. To see the queue in action, open the room with a low throughput (e.g. 2 per minute) and visit the protected page in two incognito windows: one gets through, the other waits. Copy the link with
?comporta=from the one that got through and open it in another browser: it goes back to the queue.
Waiting page with your own HTML and CSS
The waiting page uses a template, like Cloudflare Waiting Room does. The default already comes with the event color, logo and image; for full control, write your own template in the dashboard (room › Waiting page) or through the API, in the room’s page field, and preview it live before saving. The default CSS is still loaded, so you can just tweak it or rewrite everything.
<div class="minha-fila">
<h1>{{title}}</h1>
{{#isPrequeue}}<p>Sale starts in {{countdownHours}}:{{countdownMinutes}}:{{countdownSeconds}}</p>{{/isPrequeue}}
{{#isWaiting}}
<p class="numero" data-comporta-count="position">{{positionText}}</p>
<p>{{aheadText}}. Estimated time: {{etaText}}</p>
{{/isWaiting}}
{{#isYourTurn}}<a href="{{redirectUrl}}" data-comporta-action="go">Go to checkout</a>{{/isYourTurn}}
{{#isSoldOut}}<h2>Sold out</h2>{{/isSoldOut}}
{{#isChallenge}}<div data-comporta-turnstile></div>{{/isChallenge}}
</div>Syntax
{{variavel}}shows the value (always as text).{{#condicao}}...{{/condicao}}shows the block if true;{{^condicao}}...{{/condicao}}if false.data-comporta-action:go(go to checkout),rejoin(join the queue again),toggle-alert(alert with sound).data-comporta-count="position"animates the number counting down;data-comporta-turnstileis where the anti-bot challenge appears.- CSS variables:
--cp-color(event color) and--cp-progress(from 0 to 1). The animated water in the background lives in#comporta-scene; hide it with CSS if you do not want it. - No script, form, iframe or event attributes: the page runs on a shared address and the browser blocks them.
Variables
- title
- Event name (brand title or room name)
- logoUrl, imageUrl, color
- Event logo, image and color (https only, and hexadecimal color)
- positionText
- Formatted position, e.g. 1,834
- aheadText
- "1,833 people ahead of you" or "You are next"
- etaText
- Estimated time in plain language
- progress
- How far it has moved since joining, from 0 to 100
- countdownDays, countdownHours, countdownMinutes, countdownSeconds
- Pre-queue countdown
- message
- Message from the organizer
- redirectUrl, closeUrl
- Checkout link (when it is their turn) and the sold-out notice link
- notice
- Network notice (offline, unstable connection)
- buyText
- Time to buy on your turn, e.g. "You have 15 minutes to finish (until 7:42 PM)…"
- locale
- Page language (pt-BR, en or es), from the room setting or the browser
- brandUrl
- Link to the Comporta website, for the "Virtual queue comporta" line (only without white label); open it in a new tab, with target="_blank", so nobody leaves the queue
- t.yourTurnTitle, t.goToPurchase, ...
- Every waiting page text in the visitor's language; use it instead of fixed text so your template works in all three languages
Conditions: isPrequeue, isBeforePrequeue, isDrawing, isQueued, isPaused, isWaiting (in the queue or paused), isAlmost (10 or fewer ahead), isYourTurn, isExpired, isClosed, isSoldOut, isFinished, isNotOpen, isNotFound, isBadReturn, isChallenge, challengeFailed, hasMessage, hasNotice, hasCloseUrl, hasCountdownDays, showAlertToggle, alertOn, alertPush, showBranding