Guide: Transfer Matomo Goals as Conversions to Google Ads
Requirements
For the integration of the Matomo – Google Ads Conversion Importer, you need access to the following products
- Google Ads Account
- Google Spreadsheets
- Matomo Installation
- Matomo – Google Ads Conversion Importer
- 1 Requirements
- 2 A paid script is required for this guide.
- 3 Activate Google Ads Account automatic tag marking
- 4 Matomo Configuration
- 5 Configure Google Spreadsheet
- 6 Google Ads Script Installation
- 7 Testing GCLID accesses
- 8 Importing Conversion Data to Google Ads
- 9 Considerations for Conversion Import
- 10 Create Matomo Conversion in Google Ads
- 11 Attribution settings of the conversion in Google Ads
- 12 Timing of the import
- 13 Control
Activate Google Ads Account automatic tag marking
Google Ads’ automatic tag marking is the basis on which Matomo’s goal completions are passed on to Google Ads. This must be activated in the Google Ads account under Settings > Account settings > Automatic tag marking. Google has this detailed article on automatic tag marking.
When automatic tag marking is activated in Google Ads, Google automatically appends a query parameter to the destination URLs.
For example, https://webmasterei-prange.de/ becomes https://webmasterei-prange.de?gclid=213dkascjbsdcHBWDWDZG_=BDPSHJBC
At the time of writing this article, Google uses the query parameters gclid, wbraid, gbraid
Matomo Configuration
In this section, we’ll take care of all necessary configuration steps in Matomo.
Save GCLID as a dimension
Now that Google Ads is sending its click marking, we need to ensure that we can use it in Matomo.
For this, a new dimension of type “Action” is created in Matomo.
To do this, please go to Matomo and navigate to:
> Websites > Custom Dimensions > Action Dimensions > Create new dimension
The screenshot shows how this dimension must be configured:
From now on, the values of the query parameters will be stored in the dimensions. Unfortunately, a retrospective evaluation of previous data is not possible.
Create Matomo API Token
The data retrieval is then done by a Google Ads script. This requires API access to Matomo to fetch the corresponding data.
To do this, please go to Matomo and navigate to:
- > Personal > Security > Authentication tokens
- Enter a unique description there and click on “Generate new token“
- Copy the value now displayed into a file. You will need this later.
Configure Google Spreadsheet
Copy Spreadsheet Template
The conversions are taken from the Matomo API by our script, the attribution is calculated, and then we transfer the data to the Google Spreadsheet. The data is then imported from the Google Spreadsheet to Google Ads. So let’s take care of the spreadsheet.
- Open the spreadsheet:
- Create a copy of it under File > Make a copy
Enter values
Navigate to the 2nd tab of the spreadsheet “Setup” where you will find all parameters. Column A contains the parameter name, column B is where the value is entered.
Parameter | Comment |
---|---|
matomo_url | Enter the Matomo URL without a slash. e.g., https://analytics.example.com |
token_auth | Matomo API Token, as configured in the previous step. |
idSite | Value from Matomo, easiest to find in the Matomo URL. Usually, this value is 1 |
gclid_dimension | Number of the dimension you previously created in Matomo. |
reportDays | The period Matomo should search for conversions. If you have too many conversions for the sheet, you may need to adjust this value downwards. |
date | deprecated field |
conversionName | Name to which the Matomo ecommerce transaction is renamed. Required as a name in Google Ads and does not need to be adjusted. |
activeConversionNames |
Range from B9:B22 where various individual goal names can be inserted, which will be transferred to the spreadsheet. Attention! These names must be adopted 1:1 in Google Ads. |
Google Ads Script Installation
Now that data is being collected in Matomo and we have configured the spreadsheet, we only need to establish the connection between Matomo and the spreadsheet.
- Open the Google Ads interface
- Navigate to > Bulk Actions > Scripts
- Press the large + Button to create a new script.
- Name the script, e.g., “Matomo – Google Ads Conversion Importer” (see screenshot)
- Take the script as you received it from us and copy it into the spreadsheet.
- In line 6 of the script, please enter the URL of the spreadsheet that you copied earlier. (see screenshot)
- Initially ignore the yellow “Authorize” button
- Press “Preview”
- A new “Authorize” button appears. Press this and grant the necessary permissions. Tip: Google Ads users and spreadsheet editors should use the same account.
- After the authorization process, press “Preview” again. If Matomo has already collected gclid values, these should now appear in the spreadsheet.
- Press Save. You will return to the script overview.
- There you can set any time for when the conversion import should be made. A recommended time is between 4:00 and 6:00 in the morning.
Importing Conversion Data to Google Ads
Now that we are collecting data in the “Conversion Data” sheet, this data needs to be integrated into Google Ads.
- In Google Ads, go to > Conversions > Uploads Navigate there in the tabs to Schedules
- There, please press the + Button
- Select “Google Sheet” as the source and link the corresponding sheet.
- Pay attention to the yellow notice. You need to click on “Share” in the top right of the Google Sheet and add the email address from the yellow warning as a “Viewer”.
- Set a retrieval time. This should be later than the execution time of the script, so that we always import fresh data.
Create Matomo Conversion in Google Ads
In the last step, the conversions we import must also be present in Google Ads. The identifier here is the conversion name as used in the Google Spreadsheet. It is therefore important that the conversion name in Matomo matches the conversion name in Google Ads.
- Navigate in Google Ads to: Tools > Conversions
- Press the + button there to create a new conversion.
- Choose the “Import” option
- Enter a conversion name that exactly matches the conversion name in Matomo. For ecommerce transactions, please use “Matomo Transactions” as specified in the spreadsheet as ConversionName.
- You can make all other settings as usual.
In the next step, the usual conversion settings can be made.
Control
If all steps have been carried out, the script should now transfer the conversion data from Matomo to Google Ads daily at the set time.
The conversion data should be visible in the Google Ads statistics about 4 hours after the import.
For verification, you should click on the errors in Google Ads under Tools > Conversions > Uploads for an upload. You can then see the cause of the error based on the error message. Not all errors indicate a malfunction of the script.
Leave A Comment