LiveChat Integration Plugin
LiveChat adds a real-time chat widget to a website. Visitors use the widget to contact your team, while agents respond through the LiveChat application.
The LiveChat plugin for Publii adds the official Chat Widget integration to generated pages. It also provides a no-script fallback, optional Preview Mode output, and integration with Publii's built-in Cookie Banner. You do not need to edit the theme or paste the complete tracking snippet into Custom HTML.
Requirements
- Publii 0.45 or newer.
- An active LiveChat account or trial.
- The numeric License number from your LiveChat tracking code.
- An existing Publii Cookie Group if you enable consent blocking.
The Publii plugin is free. LiveChat is a separate commercial service with a trial and paid subscriptions. Check the current LiveChat plans before choosing an account.
Installing the plugin
- Open Publii's App Menu using the three-dot icon in the top-right corner.
- Select Plugins.
- Click Get More Plugins to open the Publii Plugin Marketplace.
- Open the LiveChat plugin page and download the installation package.
- Return to the Plugins screen in Publii and click Install Plugin.
- Select the downloaded ZIP file. Do not extract it before installation.
Finding the License number
- Sign in to your LiveChat account.
- Open Settings → Channels → Website.
- Open the option for installing or copying the LiveChat code.
- Find the numeric value assigned to
window.__lc.license. - Copy only that number into the plugin's License number field.
Do not paste the complete JavaScript snippet. Publii generates the current integration from the License number. LiveChat's website installation guide shows where to find the tracking code.
Activating the plugin
- Open Tools & Plugins in Publii.
- Find LiveChat and enable its switch.
- Click the plugin card to open its options.
- Enter the License number and review the fallback, Preview, and consent settings.
- Save the changes, regenerate the website, and publish it.
The plugin does not generate LiveChat code when the License number or an enabled Cookie Banner configuration is invalid.
Plugin options
Account configuration
- License number – The positive numeric identifier copied from the LiveChat tracking code. This field is required. Letters, decimal values, JavaScript, and complete tracking snippets are rejected.
Theme integration
- Fallback link text – The label shown in a direct link to LiveChat when JavaScript is unavailable. Enter plain text, such as
Chat with us. The plugin creates the address and secures the output automatically. HTML is not accepted. - Output widget in Preview Mode – Loads LiveChat in Publii Preview. This option is disabled by default because preview activity may appear in LiveChat customer traffic and reports. Enable it temporarily for testing.
Cookie Banner integration
- Require consent before loading – Blocks the complete LiveChat widget and its network requests until the visitor accepts the selected Publii Cookie Group.
- Cookie Group ID – The internal ID of an existing group under Site Settings → Privacy Settings → Cookie Groups. The option appears when consent blocking is enabled.
Using the no-script fallback
Browsers with JavaScript disabled cannot load the embedded Chat Widget. The plugin therefore adds a direct link to the LiveChat page assigned to your License number. Fallback link text controls the visible label of that link.
Enter plain text only. Version 2.0.0 escapes special characters and creates the link itself, preventing fallback content from breaking the generated HTML. When the field is empty or invalid, the plugin uses Chat with us.
The fallback appears only when JavaScript is unavailable. It does not load the widget or its resources on the Publii page. Selecting it takes the visitor to LiveChat's website.
Configuring the Publii Cookie Banner
LiveChat uses cookies and similar browser storage to maintain chat sessions and customer interactions. The appropriate consent model depends on your use of LiveChat, privacy notice, visitors, and applicable rules. The plugin can prevent the widget from loading until consent when your setup requires it.
- Open Site Settings → Privacy Settings.
- Enable the Cookie Banner and its advanced cookie configuration.
- Create or review the group used for LiveChat consent.
- Set a Group ID, such as
livechat. Use letters, numbers, hyphens, or underscores without spaces. The first character must be a letter or number. - Open the LiveChat plugin and enable Require consent before loading.
- Enter the exact same value in Cookie Group ID.
- Save the settings, regenerate the site, and test the banner.
Before the selected group is accepted, Publii holds the complete bootstrap code. The external LiveChat script, widget, cookies, browser storage, and widget-generated network requests do not start. If the banner, advanced configuration, selected group, or Group ID is missing, the plugin outputs no LiveChat code.
Read the Publii Cookie Banner documentation for details about Cookie Groups. LiveChat also provides a guide to its cookies and browser storage. These resources are general information rather than legal advice.
Updating from version 1.x
Version 2.0.0 requires Publii 0.45 or newer. Update Publii before installing the plugin update if the site uses an older release.
The existing License number, fallback value, Cookie Banner integration, and Cookie Group ID are retained. A valid existing account connection continues to use the official LiveChat widget after the update.
- Install version 2.0.0 and open the plugin options.
- Confirm that the License number is still present and contains digits only.
- Review Fallback link text. The field now accepts plain text rather than custom HTML. Replace any old link markup with a short label such as
Chat with us. - Review Cookie Banner integration. The banner, advanced configuration, and selected Cookie Group must now be valid before the plugin outputs code.
- Choose whether to enable the new Output widget in Preview Mode option. It is disabled by default.
- Regenerate and test the site before publishing the update.
The former Show preview notice option has been removed. Version 2.0.0 no longer adds a red notice to Preview. The new Preview option controls whether the real widget is loaded instead.
Testing the integration
- Regenerate and publish the site to a staging or public address.
- Open the page in a private browser window with extensions disabled.
- Confirm that the LiveChat widget appears and opens normally.
- Open the browser's developer tools and check that
https://cdn.livechatinc.com/tracking.jsloads without an error. - Send a test message and confirm that it reaches the LiveChat application.
- If Cookie Banner integration is enabled, repeat the test in a new private window. Confirm that LiveChat requests are absent before consent and appear after accepting the selected group.
- If Preview output is enabled, open Publii Preview and confirm the widget loads. Disable the option after testing if preview activity should not reach LiveChat.
Troubleshooting
- No LiveChat code appears in the generated page – Confirm that the plugin is enabled and the License number contains only a positive whole number. If consent blocking is enabled, verify the Cookie Banner configuration and selected group.
- The code appears but the widget does not load – Check the browser console and Network panel. Ad blockers, Content Security Policy rules, privacy extensions, or network errors can block the LiveChat script.
- The widget remains blocked after consent – Confirm that the Cookie Group ID in the plugin exactly matches the Group ID in Privacy Settings, including capitalization. Regenerate the site after correcting it.
- The widget loads before consent – Check that Require consent before loading is enabled and that no second LiveChat snippet exists in the theme, Custom HTML, Tag Manager, or another plugin.
- Two widgets or duplicate activity appear – Remove any additional LiveChat installation. Keep one tracking snippet unless the duplication is intentional.
- HTML appears as text in the fallback – Remove the markup and enter only the link label. Version 2.0.0 treats fallback content as plain text.
- The widget does not appear in Publii Preview – Enable Output widget in Preview Mode. The widget is omitted from Preview by default.
- The widget design or language is incorrect – Change its appearance, language, forms, greetings, and availability in the LiveChat account rather than in the Publii plugin.