If your website runs behind Cloudflare, you can add the Yaplet chat with Cloudflare Zaraz, Cloudflare's tool for loading outside scripts, without touching your site's code. You add a Custom HTML tool with the Yaplet code and let it run on every page view. If your site isn't proxied through Cloudflare, paste the code into your site directly instead, as described in Install Yaplet.
Zaraz comes with every Cloudflare plan and includes 1,000,000 free Zaraz events per account each month. Every page view counts as one event. If your account goes over that without Zaraz Paid turned on, Cloudflare switches Zaraz off until the next billing cycle, and the chat disappears with it. Menu names below are written exactly as Cloudflare's own guides show them.
1. Copy your Yaplet code
In the Yaplet dashboard's left menu, go to Brand → (your brand) → Chat widget → Install. If the tab asks where your website runs, choose Other website. Copy the code with the copy button on the code block.
If the code you copied starts with !function (Yaplet, it has no <script> tags around it yet. Zaraz needs those tags, so you add them in step 3.
2. Add a Custom HTML tool
- In the Cloudflare dashboard, go to the Tag setup page.
- If you have added tools before, select Third-party tools and click Add new tool.
- Choose Custom HTML from the tools catalog and select Continue.
- If Cloudflare asks you to grant the tool's permissions, allow them. The Custom HTML tool needs them to run scripts on your pages.
3. Paste the code
Set up the tool's action: give it a name, for example Yaplet chat, and choose Pageview under Firing Triggers. In the HTML Code field, paste the Yaplet code. The code must start with a <script> line and end with a </script> line. If what you copied starts with !function (Yaplet instead, type <script> on a new line before it and </script> on a new line after it. The finished code looks like this:
<script>
(your Yaplet code)
</script>
Then select Save.
4. Publish, if Zaraz asks for it
By default, Zaraz makes every change live right away, so there is nothing else to do. If you turned on the Preview & Publish Workflow, select Publish to make the change live.
5. Check your site
Open your site in a new browser tab and reload the page. The Yaplet chat button appears in the bottom-right corner. Click it to check that the chat opens.
For a full checklist, see Verify your installation.
If the chat doesn't appear
- The code shows up as text on your pages. The
<script>tags are missing: Zaraz adds anything outside them to the page as text. Edit the action and add the tags. - Nothing appears at all. Zaraz may not be loading. Check that your domain is proxied by Cloudflare, that Auto-inject script is on in Zaraz's settings, and that the Custom HTML tool is enabled.
- The chat waits for cookie consent. If you use Zaraz's consent management and assigned the Custom HTML tool to a purpose, the tool only runs after the visitor agrees to that purpose.
- The chat loads twice on a single-page app. If Single Page Application support is on in Zaraz's settings, open the Custom HTML action, select Add Field, add Ignore SPA and switch it on.
- The chat stopped working after a busy month. Your account may have used up its free Zaraz events. Turn on Zaraz Paid on the Zaraz plans page, or wait for the next billing cycle.
- You still see the old page. Your browser or your site's cache may show an older copy. Reload the page, or open it in a private window.
What's next
To see what the code does and where your widget ID is, read Install Yaplet.