How do I trigger a Goal Conversion when a user clicks a link, using Matomo Tag Manager?
The recommended method for tracking goal conversions is to use the Goal Triggers that can be setup when creating a Goal as explained in the Goal Tracking User Guide
However, in some cases it won’t be possible to track a goal conversion using the URL of the page (For example when a link opens the page in an iFrame).
In such a case we can use the Matomo Tag Manager to track the goal conversion for specific links, or for links that contain specific parameters or strings.
Let’s take an example link that a visitor may click:
example.com/my-goal (This is just an example, your URL can contain a simple path as shown here, or a more complex one such as
- Create your Goal in Matomo and make a note of the Goal ID
Create a Matomo Tag Manager Trigger with the following settings:
« All Links Click » as the trigger type with name being for example « Signup Link Trigger »
And then add the following to the trigger conditions:
Clicks > « Click Destination URL contains my-goal »
(If you have other URLs that contain this string, then you may need to add additional conditions to only trigger on these specific URLs such as a regular expression/regex)
Please note that this trigger will only fire if all of the conditions specified here are matched, so you will not be able to add each unique call to action link as a trigger.
Optional: If you only wish this goal to be triggered from a specific page on the website, you can add an additional trigger (Lets say for example if we only wanted to track this goal conversion from a specific section of our website, such as the « shop » section):
Page Variables > « Page URL equals https://example.com/shop »
Create a new « Matomo Analytics » tag with name « Signup Link Tag »
The Goal ID we created in step 1
And configure the tag the Execute when the « Signup Link Trigger » is triggered
Test the new Tag and Trigger using the preview mode on the page you wish to use it to ensure that the goal is being tracked correctly.
Once tested, you can publish the container to your Live container version.