Why embed a giveaway
An embedded widget keeps the giveaway beside your own content, so a visitor can read about your product and enter on the same page.
- Visitors enter without leaving your page.
- Your own headline, branding and copy sit around the entry form.
- You paste the snippet once, and widget updates arrive on their own.
Create your giveaway
Build your promotion in Tokei, choose a template, add the prize and entry actions, then publish it. The recording below shows the editor.
Copy the snippet
Open your published promotion in the dashboard, click the Embed icon, then click Copy Snippet. Embedding needs a paid plan and is locked during the trial. The snippet looks like this.
<a class="tokei-widget"
href="https://tokei.io/contest/YOUR_KEY"
data-tokei-contest="YOUR_KEY">View the promotion</a>
<script src="https://tokei.io/widget/tokei.js" async></script>
Paste it into your site
Add the snippet where you want the giveaway to appear, in any block that accepts custom HTML. The widget replaces the link once the script loads. If the script is blocked, visitors still see a working link to your promotion.
The widget is up to 672px wide, so give it a column with room. Preview the page after you save it, because some site builders only run scripts on the published page.
A live example
FLIP64's giveaway puts the widget beside its own prize artwork and headline.
Embed options
Add data-tokei-theme to the link to override the theme. Host pages can also listen for the TOKEIWidgetReady:YOUR_KEY message, which the widget posts once it has loaded.
If it doesn't load
- Check that your site builder allows scripts in custom HTML blocks.
- Check that the contest key in the snippet matches your promotion.
- If your site sets a Content Security Policy, allow tokei.io for scripts, connections and frames.
