Ad campaign and conversion tracking are essential for optimising marketing strategies. With Matomo’s comprehensive features, you can track your Google Ads campaign performance, enabling you to continue measuring your campaigns effectively.

Important Note: When using Google Ads or Google Analytics to analyse data from website visitors from the European Economic Area, Switzerland, and UK must comply with Google’s EU User Consent Policy. For data uploads to Google, consult with your legal department on a consent management solution that fits your business needs.

This guide describes the process of tracking Google Ads and Pmax campaigns in Matomo and creating a segment to view only paid traffic.

Track Google Ads Campaigns in Matomo

By default, when you run Google Ads, Matomo does not automatically track them. Clicks on your Google Ads will be recorded as organic traffic from Google and as a result, paid and organic traffic are grouped together.

To ensure correct tracking of your Google Ads campaigns, specific tracking parameters must be added to your ad URLs. Matomo provides a Campaign URL builder to simplify this process.

  1. Log in to Matomo and open Acquisition > Campaign URL Builder.

  2. By using the campaign tracking parameters, you can send additional data to Matomo. It is recommended to use the Website URL and Campaign Name parameters; all other parameters are optional.
    Website URL: the full URL of the page where you want to send visitors.
    Campaign Name (mtm_campaign): the name of your ad campaign.
    Campaign Keyword (mtm_kwd): the keyword associated with this campaign.
    Campaign Source (mtm_source): the source of your campaign (e.g., Google).
    Campaign Medium (mtm_medium): the type of source (e.g., paid-search).
    Campaign Content (mtm_content): the content of your ad.
    Campaign ID (mtm_cid): a Campaign ID identifier for your ad or Click ID identifier.

  3. Click Generate URL and depending on the campaign parameters added, your campaign URL will look similar to this: https://your-website.com/?mtm_campaign=Campaign-Name&mtm_kwd=Your-Keyword&mtm_source=google&mtm_medium=paid-search&mtm_content=My-Ad-Headline&mtm_cid=ad12345

If each ad URL is fired by different keywords and associated with different campaigns or headlines, you can customise the campaign parameters for each URL. By using Tracking templates in Google Ads, each URL parameter can be automatically filled.

Note: If you are using an older version of Matomo (3x and below), you need to replace the campaign parameter prefix with pk_ instead of mtm_. The latest version of Matomo recognises the campaign tracking parameter with the prefixes mtm_, matomo_, pk_, piwik_, and utm_.

By default, Matomo detects URLs tagged with Google Analytics (GA) campaign parameters, so you do not need to update your existing GA campaign tracking URLs when using Matomo. If you are using campaign tracking URLs with parameters that are not recognised by default, you can customise Matomo to accept additional parameters. Find out more about tracking campaigns in Matomo.

Adding tracking parameters to each URL manually can be time-consuming, particularly for managing a large number of ads. Google Ads offers tracking templates at the Account, Campaign or Ad Group level to streamline this process.

Set up an Account-level tracking template

  1. Open Google Ads and go to Settings > Account Settings.

  2. Define your tracking template pattern.
    For example: https://your-website.com/?url={lpurl}&mtm_campaign=AdWords&mtm_kwd=Your-Keyword&mtm_source=google&mtm_medium=paid-search&mtm_content=My-Ad-Headline
    use Google Ads tracking templates - Matomo

  3. This pattern applies to all URLs in your account if the domain is the same across all your ads. The URL parameter is mandatory.

  4. Instead of using static values for mtm_campaign and mtm_kwd, Google allows dynamic insertion.
    For example: https://your-landing-page.com/?url={lpurl}&mtm_campaign={campaignid}&mtm_kwd={keyword}&mtm_source=google&mtm_medium=paid-search&mtm_content={creative}
    The {keyword} placeholder is automatically replaced with the keyword, which fired the ad within your account. Learn more about dynamic tags supported by Google Ads.

Set up a Campaign-level tracking template

  1. Open Google Ads and go to Settings > Campaign URL options.

  2. Define and test your tracking template pattern.
    Google Ads tracking in Matomo

Set up an Ad Group-level tracking template

You can define tracking templates at the Campaign, Ad Group or Ad-level and templates set at these levels take precedence over the Account-level template. With properly configured URLs, you can analyse your Google Ads traffic performance in Matomo when traffic is generated from those sources.

Track Google Ad conversions without a Google tag

Google Ads tracks metrics like impressions, clicks, cost-per-click (CPC), and click-through-rate (CTR), but these metrics do not provide insights into how your ads perform in terms of conversions.

Embedding a Google tag on your site is a common solution but it may compromise privacy compliance by using third-party cookies. Matomo’s Advertising Conversion Export feature allows you to send conversion data to Google Ads with a gclid (Google Click Identifier).

The gclid is a parameter that Google Ads automatically appends to the ad’s URL. When a visitor clicks on the ad and converts (e.g., newsletter signup), Matomo sends the gclid and conversion data (e.g., conversion time, conversion value (if defined), conversion currency and conversion name) to Google Ads. An example URL displayed to the visitor: www.your-website.com/?gclid=321abc

Export conversion data

There are two ways to export conversion data to Google Ads:

  1. Manual upload: Download a conversion export in a CSV format and upload it to Google Ads.
  2. Scheduled import via HTTPS source URL: Download a unique link to add to your Google Ads Conversion Uploads and then schedule the import into Google Ads.

Note: It can take up to three hours for Google Ads to display the detailed conversion data.

Advertising Conversion Export

The Matomo Advertising Conversion Export feature supports conversion exports to Google Ads, Microsoft Advertising (Bing Ads) and Yandex Ads using each platform’s respective click ids. By connecting your marketing platform and Matomo through the conversion export feature, you create a very powerful and compliant method for tracking campaign performance.

Track Google Ads Pmax Campaign

Google Ads Performance Max (Pmax) campaigns are designed to maximise your advertising performance across your Google channels. Learn more about Performance Max campaigns on the official Google website.

Set up Pmax campaign tracking parameters

To track Pmax campaigns in Matomo, you need to use campaign tracking parameters similar to those used for Google Ads campaigns. These parameters allow Matomo to differentiate between the different campaigns, ads, and keywords.

  1. Log in to Matomo and open Acquisition > Campaign URL Builder.

  2. You can define the Website URL and Campaign name and optionally use the prefix Pmax for the campaign name and medium and use any other optional parameters as required.

  3. Click Generate URL.

  4. When setting up your Pmax campaign in Google Ads, add the tracking parameters generated from Matomo to the final URL of your ads.

Tracking Pmax campaigns in Matomo

Once your Pmax campaign is live and tracking configured, you can start monitoring your campaign in Matomo.

  1. Log in to Matomo and open Acquisition > Campaigns to view your Pmax campaigns.

  2. You can create custom reports and segments to gain deeper insights into the channels where your Pmax campaigns are driving the most value.

Create a Segment to view Paid Traffic only

Creating a segment in Matomo allows you to filter your analytics data and focus on specific types of traffic. To view only paid traffic from Google Ads, you can define a segment to report on this subset of data.

  1. From the Matomo dashboard, click on the Segment filter to expand the menu.

  2. Click Add New Segment and provide a descriptive name.

  3. Using an example URL and campaign parameters for a Google Ads campaign:
    https://your-website.com/?mtm_campaign=Season-Sale-2024&mtm_kwd=discounts&mtm_source=google-ads
    If mtm_source=google-ads is consistently used for all Google Ads campaigns, the segment can be created based on the condition:
    Campaign source Is google-ads to track all visits from Google Ads.
    matomo segment paid traffic
    If you only wanted to track the campaign, define the segment based on the Campaign Name Is Season-Sale-2024 (based on the above example URL).

Previous FAQ: Visits and clicks data provided by search engines or ad networks or affiliates do not match the acquisition reports in Matomo?