Integrating Google remarketing tags with Matomo Tag Manager lets you track visitors on your website and serve them targeted ads. Create triggers based on specific conditions, like user actions, to execute the remarketing tag only when needed.

You can build audience lists in Google Ads and use the data to create custom segments in Matomo based on user behaviour. This enables you to re-engage specific audiences with personalised ads that encourage them to return or convert.

Important: If you are targeting users in Europe, be aware that triggering retargeting tags like Google Ads Remarketing requires user consent under GDPR. Ensure that you configure the tag to fire only after consent has been given.

Prerequisites

  1. Before setting up the tag in Matomo, configure your remarketing tag in Google Ads.
  2. Once configured, copy the remarketing tag code provided by Google Ads and paste it into the <head> section of every website page you want to track.

Setup in Matomo Tag Manager

The next step is to integrate the remarketing tag with Matomo Tag Manager. This specifically involves creating a custom HTML tag, defining the conditions under which it executes, and ensuring it deploys correctly across your site.

  1. Login to Matomo and open Tag Manager.
  2. Click Configure Container for the container where the new tag and trigger will be saved.
  3. Navigate to Tags and click Create New Tag.
  4. Select the Custom HTML tag type because you need to manually enter the Google remarketing tag code.
  5. In the tag configuration page, enter a unique Name for the tag, which is publicly visible when the container is in preview/debug mode. Adding a Description is optional.
  6. Paste the Google remarketing tag code (copied from Google Ads) into the Custom HTML field.
    matomo custom html google remarketing tag

  7. In the section, Configure when the tag should do this, define when the remarketing tag executes by clicking Create a new trigger now. The trigger configuration page displays for you to setup and save the appropriate trigger, such as Pageview or Custom Event.

  8. When the trigger activates, it will inject the Google remarketing tag script into the website’s HTML to track visitors and build audience lists for targeted advertising.
    Example
    To execute the remarketing tag when a specific product is viewed, create a trigger that activates when the page URL contains a specific product parameter e.g., product=13849.
    matomo pageview trigger remarketing tag

  9. To save the new custom HTML remarketing tag, click Create New Tag.

  10. Always test the new setup before deploying it across your entire site to ensure it behaves as expected.

Previous FAQ: Develop custom tags