How to Connect Matomo to Looker Studio
Migrating your web analytics to Matomo is a fantastic step for data privacy, but you might find yourself missing the powerful and flexible data visualization capabilities of Looker Studio. This guide will walk you through several methods to connect your Matomo data to Looker Studio so you can build the custom-tailored dashboards your team needs.
Why Connect Matomo to Looker Studio?
Matomo provides its own set of dashboards, and they are excellent for day-to-day analytics. However, Looker Studio (formerly Google Data Studio) excels in a few key areas that make this connection so valuable:
- Unified Reporting: It allows you to pull data from dozens of different sources into a single view. You can display your Matomo traffic data right next to your Google Ads spend, your CRM data from HubSpot, and your sales figures from a Google Sheet. This holistic view is critical for understanding your entire customer journey.
- Unlimited Customization: Looker Studio offers a blank canvas to build reports exactly how you want them. You have full control over chart types, branding, layouts, and calculated fields to create bespoke dashboards that answer your specific business questions.
- Easy Sharing and Collaboration: You can easily share interactive, real-time dashboards with team members or clients without giving them direct access to your Matomo instance.
The main challenge is that there isn't a direct, one-click connector from Matomo to Looker Studio. But don't worry, there are several reliable workarounds to make it happen.
Methods for Connecting Matomo to Looker Studio
There are three primary ways to get your Matomo analytics into a Looker Studio report. Each has its pros and cons, depending on your technical comfort level, budget, and reporting needs.
- Third-Party Connectors (Easiest): This is the most straightforward approach. Services like Supermetrics, Power My Analytics, and others have built dedicated Matomo connectors for Looker Studio. They handle all the complexities of the API connection for you. The main drawback is that these are paid subscription services.
- Google Sheets as a Middleman (Most Cost-Effective): This method involves using a simple Google Apps Script to automatically pull data from Matomo's API into a Google Sheet. You then connect that Google Sheet to Looker Studio. It’s free, highly customizable, and perfect for teams comfortable with a little bit of setup. We'll focus on this method in our detailed guide below.
- Manual CSV Exports (Not Recommended for Dashboards): You can always export reports from Matomo as a CSV file and upload it to Google Sheets or directly to Looker Studio. This is fine for a one-time analysis but is completely impractical for building live, updating dashboards, as it requires manual work every time you want fresh data.
Step-by-Step: Connecting Matomo via Google Sheets and API
This is the most powerful and flexible free method. It might seem intimidating, but a little copy and pasting is all that's required. We will break down every step.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Part 1: Get Your Matomo Authentication Token
First, you need an "auth token" to give your Google Sheet permission to access your Matomo data. Think of it as a special password for an application.
- Log in to your Matomo dashboard.
- Click the gear icon (⚙️) in the top menu to go to Administration.
- In the left-hand navigation, go to Personal >, Security.
- Scroll down to the Auth Tokens section.
- Click the "Create new token" button. Give your token a description (e.g., "Looker Studio Connector") and click "Create".
- Matomo will generate a long string of letters and numbers. Copy this token and save it somewhere secure. You won't be able to see it again after you leave this page.
Part 2: Find Your Matomo Site ID
Next, you need to tell the API which website's data to pull. Each property in Matomo has a unique Site ID.
- In the Matomo Administration menu, navigate to Measurables >, Manage.
- You'll see a list of all websites you're tracking. The ID number is listed right next to the website name. Jot down the ID for the site you want to connect. It is usually "1" if you only have one site.
Part 3: Construct Your API Request URL
Now, we build the special link (URL) that fetches the specific data we want. Matomo's API is very powerful, letting you pull almost any report. For this example, let's create a URL to pull daily sessions and pageviews for the last 30 days.
Your API URL will look like this. You will need to replace the placeholders.
https://YOUR_MATOMO_URL/index.php?module=API&method=VisitsSummary.get&format=tsv&idSite=YOUR_SITE_ID&period=day&date=last30&token_auth=YOUR_AUTH_TOKEN
Let's break that down:
https://YOUR_MATOMO_URL/: Replace this with the URL of your Matomo instance (e.g.,https://analytics.mywebsite.com/).method=VisitsSummary.get: This specifies which report we want. You can find dozens of other methods in the Matomo API Reference.idSite=YOUR_SITE_ID: Replace with the Site ID you found in Part 2.period=day: Tells Matomo to group the data by day.date=last30: Sets the date range. You can also use specific dates like2023-10-01,2023-10-31.format=tsv: This tells Matomo to return the data in a tab-separated value format, which is very easy for a spreadsheet to read.token_auth=YOUR_AUTH_TOKEN: Replace with the auth token from Part 1.
Once you fill in your details, paste the URL into your browser's address bar and hit Enter. If it works, your browser will download a file or display plain text with your analytics data. Now you're ready to automate it!
Part 4: Use Google Apps Script to Automate the Data Pull
Here’s where the automation comes in. We’ll write a small piece of Javascript that runs inside your Google Sheet.
- Create a new Google Sheet. Let's name it "Matomo Data".
- Go to Extensions >, Apps Script. A new browser tab will open with the script editor.
- Delete the placeholder code and paste the following script into the editor:
// Matomo to Google Sheets Data Fetcher
function importMatomoData() {
// 1. Set your Matomo API URL
// Replace the URL below with the one you constructed in Part 3
const apiUrl = "https://YOUR_MATOMO_URL/index.php?module=API&method=VisitsSummary.get&idSite=YOUR_SITE_ID&period=day&date=last30&format=tsv&token_auth=YOUR_AUTH_TOKEN",
// 2. Specify the target sheet
// This will write data to the sheet named 'Sheet1'. Change if your sheet has a different name.
const sheetName = "Sheet1",
try {
const response = UrlFetchApp.fetch(apiUrl),
const tsvData = response.getContentText(),
const data = Utilities.parseCsv(tsvData, '\t'), // Use tab as the delimiter
if (data) {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName),
sheet.clear(), // Clear existing data before writing new data
sheet.getRange(1, 1, data.length, data[0].length).setValues(data),
Logger.log("Data successfully imported to " + sheetName),
}
} catch(e) {
Logger.log("Error fetching or parsing data: " + e.toString()),
}
}- VERY IMPORTANT: In the script, replace the placeholder URL on line 5 with the exact API URL you built in Part 3.
- Click the floppy disk icon (💾) to save your script. Give the project a name, like "Matomo Import."
- To test it, click the "Run" button (▶️). The first time, Google will ask for permissions. Click "Review permissions," select your Google account, and click "Allow" on the warning screen (this is normal because the script hasn't been verified by Google). The script will run and populate your "Sheet1" with the Matomo data!
Part 5: Set a Trigger for Automatic Refresh
To keep your dashboard’s data fresh, you need the script to run automatically.
- In the Apps Script editor, click the clock icon (⏰) on the left to go to Triggers.
- Click the "+ Add Trigger" button in the bottom right.
- Configure the trigger with these settings:
- Click "Save." Now, your Google Sheet will automatically fetch the latest data from Matomo every day.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Part 6: Connect the Google Sheet to Looker Studio
The hard work is done! This last step is quick and easy.
- Go to lookerstudio.google.com and create a new, blank report.
- Looker Studio will ask you to add data. Select the Google Sheets connector.
- Find and select the "Matomo Data" spreadsheet you just created. Ensure "Use first row as headers" is checked.
- Click "Add." Your data is now connected!
You can now start building your dashboard. Drag a 'Date' field to a time series chart's date dimension and drag your 'nb_visits' and 'nb_pageviews' fields into the metric section. You have successfully created your first updating Matomo chart in Looker Studio!
Final Thoughts
Connecting your private Matomo analytics to Looker Studio gives you the best of both worlds: privacy-focused data collection and elite-level data visualization. Whether you use a paid third-party connector for convenience or the API and Google Sheets method for cost-effective flexibility, you can create unified dashboards that truly explain your business’s performance.
Manually connecting APIs and wrangling data in spreadsheets is exactly the type of friction we built Graphed to eliminate. Our approach is to simplify this entire process by offering one-click integrations to your marketing and sales platforms. Instead of crafting API URLs and writing scripts, you just connect your sources and ask questions in plain English - like "create a dashboard comparing Facebook Ads spend vs Google Analytics conversions for the last month" - and we instantly build the live, auto-updating dashboard for you.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.