How to track Google Ads campaigns with Matomo

Contents

Ad campaign and conversion tracking are critical to understanding what works and what doesn’t, so you can optimise, reduce ad spend and improve your overall return on investment.

For those considering switching from Google Analytics but concerned about losing the ability to track Google Ads campaign performance, you’ll be pleased to learn that Matomo offers features that allow you to continue to measure your campaigns. 

In this blog, we'll cover:

What you need to know about Google Ads and Matomo

By default, each ad you create in Google Ads is not tracked in Matomo. Every click on your ad is identified in Matomo as an organic result coming from Google with the following value: “Keyword not defined”.

In short, if you do not properly track your Google Ads campaigns, both your paid and organic traffic will be grouped together within your Matomo account. It will be impossible for you to measure your return on investment and it means that you are throwing your money down the drain. However, there is a simple solution to resolve this.

How to track Google Ads campaigns in Matomo

If you want to analyse Google Ads campaigns within Matomo properly, you need to add additional tracking parameters to the final URL of each of your ads.

We recommend using the Matomo campaign URL builder to add the tracking parameters. If you are already using Matomo, you can access this feature within your Matomo. Go to Acquisition > Campaign URL Builder. 

With the Matomo campaign URL tracking parameters, you will be able to push additional data to Matomo such as:

  • 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 for the click

The only parameter that is required is the campaign name (mtm_campaign), all others are optional and can be adjusted to suit your needs.  

Please note: If you are using an older version of Matomo, you will need to replace the campaign paramater prefix with pk_ instead of mtm_ For example, in the latest version of Matomo the following parameters are all recognised and accepted by default for the campaign tracking parameter:
  • mtm_campaign
  • matomo_campaign
  • pk_campaign
  • piwik_campaign
  • utm_campaign
Both pk_ and piwik_ were the parameters used in older versions of Matomo (3.x and below).

If you are using Google Analytics, by comparison, this is equivalent to the GA campaign URL builder, which uses UTM codes. By default, Matomo detects URLs tagged with Google Analytics campaign parameters. So there is no need to update your existing GA campaign tracking URLs when you use Matomo.

If you are already using campaign tracking URLs with parameters that are not recognised by default, then it is possible to customise your Matomo instance to accept additional parameters.

Find out more about tracking Campaigns in Matomo.

If your campaign URL looks like this: https://your-website.com/, your campaign URL will then look like this after adding the campaign parameters:

https://your-website.com/?pk_campaign=Name-Of-Your-Campaign&pk_kwd=Your-Keyword&pk_source=google&pk_medium=cpc&pk_content=My-Ad-Headline&pk_cid=abc_1234567

As each ad URL can be fired by different keywords and can correspond to different campaigns or headlines, you will need to customise the campaign parameters for each URL.

Customsing all of your URLs individually would take you a lot of time under circumstances. That’s why you should know, that each URL parameter can be filled automatically in Google Ads with a feature called “Tracking template”.

Simplifying the campaign URL parameters with tracking templates

You can define tracking templates either at the account, campaign or ad group level. For example, by using a tracking template at the account level, all your campaigns will have the same landing page with the URL parameters you defined in the tracking template. By defining it at the campaign level, it means that all your ad groups within the campaign will have the same landing page and so on and so forth. Any tracking template defined in a campaign, will overwrite a tracking template defined at the account level.

Tracking template at the account level

To edit the template at the account level, you need to click on “Settings”, then click on the “Account” settings tab and define your tracking template pattern. For example:

https://your-website.com/?url={lpurl}&pk_campaign=AdWords&pk_kwd=Your-Keyword&pk_source=google&pk_medium=cpc&pk_content=My-Ad-Headline
Google Ads - Matomo

This will apply to all your URLs within your account. So it is only useful if your website domain is the same across all your ads. The URL parameter is compulsory here.

It can be limiting to have a static value for “pk_campaign” and “pk_kwd” so Google allows you to use dynamic insertion, such as follows:

https://your-landing-page.com/?url={lpurl}&pk_campaign={campaignid}&pk_kwd={keyword}&pk_source=google&pk_medium=cpc&pk_content={creative}

The “{keyword}” means that the data is automatically replaced with the keyword which fired the ad within your account.

Visit the following page if you want to know more about the different dynamic tags that Ads supports: https://support.google.com/google-ads/answer/6305348#urlinsertion

Tracking template at the campaign level

If you wish to define a tracking template at the campaign level, you will find this option within the “Campaign” settings under the campaign URL options:

Google Ads tracking in Matomo

Tracking template at the Ad Group level

You can also set it at the Ad Group level within the “Ad Group” settings:

Tracking Google Ads Campaigns in Matomo

As Google mentions: “If you set up URL options at the campaign level, ad group level, or ad level, those settings will override the account-level options“.

Now that your URLs are properly configured, you will be able to analyse Ads traffic performances within Matomo once traffic is generated from those sources.

Tracking Google Ads Campaign Names in Matomo

How to use Matomo to track Google Ads conversions without a Google tag

Within Google Ads, you can automatically track a variety of metrics such as impressions, clicks, cost-per-click (CPC), click-through-rate (CTR) and more. These metrics provide insight into how your ads are performing within Google (or Google partners, depending on your ad placement) but they don’t help in understanding how your ads are performing in terms of conversions.

To get this information, most would suggest that you embed a Google tag on your site. This is a common misconception and often does not meet global privacy compliance and security requirements because it uses third-party cookies.

Instead, with Matomo’s Advertising Conversion Export feature, you can send goal completion data to Google Ads with a “gclid” (short for Google Click Identifier). This is a unique parameter that Google Ads automatically appends to your ad’s URL allowing you to transfer information from your Matomo to your Google Ads account without the use of third-party cookies.

For instance, if we were running an ad to our example site (www.your-website.com) and a visitor clicked on the ad, their URL might look something like:

www.your-website.com/?gclid=123abc

If that visitor were to convert on a goal defined within our Matomo (e.g., newsletter subscription), then Matomo would send that gclid along with all conversion details (e.g., conversion time, conversion value (if defined), conversion currency and conversion name) to Google Ads.

From there, we would be able to see additional conversion information within our Google Ads, for instance, the landing page that resulted in the conversion, the keyword that was used, the time of the conversion, etc.

This data can be shared with Google Ads in two ways:

  • Manual CSV upload: Matomo provides a downloadable conversion export in the format of a CSV document.
  • Scheduled import via HTTPS source URL: Matomo provides a link that you can add to your Google Ads Conversion Uploads. You can then schedule how often and when Google Ads will import the results.

Note that it does take approximately 3 hours for Google Ads to display this conversion data.

The Advertising Conversion Export feature also supports conversion exports to Microsoft Advertising (Bing Ads) and Yandex Ads using each platform’s respective click ids.

By connecting your Google Ads and Matomo through the conversion export feature, you create a very powerful and compliant method for tracking campaign performance.

Start accurately tracking your Google Ads performance without third-party cookies – try Matomo free for 21-days now. No credit card required.

Enjoyed this post?
Join the 160,000+ subscribers who receive the Matomo Newsletter straight to their inbox every month
Get started with Matomo

A powerful web analytics platform that gives you and your business 100% data ownership and user privacy protection.

No credit card required.

Free forever.

Get started with Matomo

A powerful web analytics platform that gives you and your business 100% data ownership and user privacy protection.

No credit card required.

Free forever.