Event widgets
Show AllEvents events on your website with two lines of HTML. No API key in the page, no code to maintain.
What a widget is
A widget is a small list of events that you set up once in your dashboard and embed on any page of your site. It is rendered on our servers, so your API key never reaches the browser, and it works on sites where you can only paste HTML.
- City: upcoming events in a city, optionally for some categories (such as
music) and a date range (today, this weekend, this month…). - Organizer: the upcoming events of one organizer.
- Search: events in a city that match a keyword.
City and search widgets can also be sorted (soonest first, most popular, most interested, or by price) and narrowed to free or paid events.
You choose how many events to show (3 to 10), an optional heading, a list, grid or compact layout, a light, dark or automatic theme, an accent color, and whether to show images, dates, venues and prices. Each event links to its page on AllEvents, in a new tab or in the same tab.
Create a widget
- Sign in and open Widgets in the dashboard.
- Choose what to show, for example events in Austin, TX this weekend.
- Pick the look. The preview shows the widget as your visitors will see it.
- List the domains where it may appear, and the API key its calls should use.
- Save, then copy the embed code.
An account can have up to 10 widgets. You can turn a widget off at any time without removing it from your site.
Add it to your site
Paste the embed code where the events should appear. The script adds the widget when it scrolls into view and sizes it to fit its events:
<div data-allevents-widget="Xk3fQ9wLmA2pR7tZ"></div>
<script src="https://developer.allevents.in/widget.js" async></script>If your site doesn't allow scripts, use a plain iframe instead. Its height is fixed, so it scrolls when the events don't fit:
<iframe src="https://developer.allevents.in/w/Xk3fQ9wLmA2pR7tZ" title="Events" width="100%" height="480" style="border:0;max-width:100%" loading="lazy"></iframe>On single-page apps, call window.AllEventsWidgets.scan() after adding a widget element to the page. Optional attributes on the element: data-height (starting height in pixels) and data-title (the frame's accessible name, default “Events”).
Allowed domains
A widget only shows on the domains you list, over https. Browsers refuse to show it anywhere else, so other sites can't use your widget or your credits.
example.comallows exactly that host. Addwww.example.comtoo if your site uses it.*.example.comallows every subdomain, such asblog.example.com, but notexample.comitself.- Up to 20 domains per widget. Leave out the scheme, port and path.
- A domain that doesn't exist (usually a typo) is refused when you save, with its name.
Testing your embed. Paste the code into a page on one of your allowed domains. Online HTML viewers that run your code in a sandboxed or data: frame, such as html.onlineviewer.net or codebeautify.org, can't show widgets: the browser gives those frames no website address, so no allowed domain can match, and the browser refuses the widget with a frame-ancestors error. Viewers that show your code as a normal page or a blob: frame on their own domain, such as codeshack.io, work once that domain is allowed.
Credits and caching
A widget calls the API with the key you picked, exactly like your own code would: the same credits, coverage and rate limits apply, and the calls show in your usage with the user agent AllEvents-Widget/<widget id>.
Visitors don't each cause a call. A widget's events are kept for about 10 minutes, so a busy page makes about one call per 10 minutes, and answers from the API cache use no credits. Pick a key without IP or website limits: the calls come from our servers.
When events can't be shown
If the widget is off or deleted, or the account is out of credits, suspended or over its rate limit, the widget shows a short “Events are unavailable right now” message. It never shows errors or details about your account. When nothing matches, it says there are no upcoming events.
Questions
- Does the widget slow down my page?
- No. The script is tiny and loads asynchronously, the widget loads only when it's about to scroll into view, and images load lazily.
- Is it accessible?
- Events are a real list of links with visible focus, it follows the visitor's light or dark setting on the automatic theme, and it fits containers down to 280 pixels wide.
- Do I need to write code or host anything?
- No. You set the widget up in the dashboard and paste two lines of HTML. We render it, keep its events up to date and serve it.
- Does my API key appear in the page?
- No. The page only holds the widget id. The widget is rendered on our servers, which call the API with the key you picked.
- How are clicks tracked?
- Event links carry utm_source=api_widget, utm_medium=widget and the widget id as utm_campaign. A small “Events by AllEvents” credit sits under the list.
- Need more control?
- Use the API directly and build your own list.