With Matomo Tag Manager, you can display the ViaSay widget on all your site's pages without modifying its code. All it takes is one tag and one trigger. The person managing Matomo can do it alone, without a developer.
Before you start
A Matomo account that can create tags and publish the container (the area that groups your site's tags).
Matomo Tag Manager already installed on your site: its code is loaded on each of your pages.
Your ViaSay Widget code, in Build > Integrate > Channels > Integration. If you do not have a Widget yet, start by Creating a ViaSay Widget.
Tip: set Audience Distribution to 0% during setup. The code is deployed, but the widget remains hidden. You can then display it by changing the percentage in Integration, without touching Matomo.
Step 1: create the tag
A tag is the code that Matomo adds to your pages. Here, it is the widget's code.
Open Tag Manager, then click Tags in the left-hand menu.
Click Create New Tag.
Choose the Custom HTML type, in the Custom category. It accepts any code, including the widget script.
In Name, enter “ViaSay Widget”.
In Custom HTML, paste your Widget code. Leave Position to Body End.
The token (your Widget's identifier) shown in the screenshot is fictitious: paste your own Widget's code.
Step 2: display the widget on all pages
A trigger tells Matomo when to launch the tag. The Pageview trigger launches it on every page view, and therefore across the entire site.
Scroll down to Configure when the tag should do this.
Open the first dropdown list and choose Pageview.
Click Create New Tag at the bottom of the form.
The tag appears in the list, with the Pageview trigger. It is not live yet: you still need to test it and then publish it.
Step 3: test before publishing
Preview mode displays your site with the new tag, visible only to you.
Click Preview / Debug in the left-hand menu.
Enter your site's address, then click Debug. Your site opens in a new tab.
In the Matomo panel at the bottom of the page, check that ViaSay Widget appears under Fired Tags.
Click Stick to Top if the panel hides the bottom of the page: the widget then appears in the bottom-right corner.
Step 4: publish
Click Publish in the left-hand menu, or click the Publish a new version now link in the green banner.
Enter a version name, for example “ViaSay Widget”.
Click Create New Version And Publish Release.
Click Disable Preview in the left-hand menu to exit preview mode.
Check that it works
Open your site in a private browsing window.
Browse a few pages: the widget should appear on each one.
You will see it in the position set in Format & Design. If you set Audience Distribution to 0%, it remains hidden until you change the percentage.
If it does not work
The Custom HTML type is not available: Matomo allows these tags to be disabled for security reasons. Ask an administrator to re-enable them in Administration > General Settings.
ViaSay Widget does not appear under Fired Tags: the tag has no trigger. Open it and repeat step 2.
The debug panel does not appear: add ?mtmPreviewMode= followed by the container identifier to your site's address. Matomo displays it on the Preview / Debug.
The tag triggers, but the widget does not appear: check the token pasted into the tag and your Widget's Audience Distribution setting.
Next steps
Manage your widget's visibility: choose the pages where it appears.
Cookie acceptance for displaying the widget: adapt its display to your visitors' consent.
Install the Widget with Google Tag Manager: the same installation with Google's tool.