Ever wondered what part of the site converts best? Or what combination of content and traffic source generates the most valuable visitors?

The Enhanced Attribution plugin for Matomo provides insights into goal conversions by combining goal URLs with visitor (device type & location) and traffic source data (source, medium, campaign).

Fetch the data via Matomo's API for detailed analysis or view the web report for quick insights.

Requires the free MarketingCampaignsReporting plugin.

More about the plugin: English · Svenska

Features

  • Enhanced Goal URL Analysis: Detailed tracking of goal conversion URLs with visitor data
  • Visitor Attribution: Indicator for return visits, source, medium & channel
  • Geographic Data: Country, region, and city information for goal conversions
  • Technical Information: Operating system, browser, device type, and screen resolution data

Plugin page: English · Svenska

Requirements

Installation

Install and activate MarketingCampaignsReporting first. Matomo won't activate EnhancedAttribution without it.

Then install via the Matomo Marketplace or manually:

  1. Copy the plugin files to your Matomo installation:

    /path/to/matomo/plugins/EnhancedAttribution/
    
  2. Activate the plugin through the Matomo admin interface or via console:

    ./console plugin:activate EnhancedAttribution
    

API Methods

getGoalUrlsDetailed

Returns detailed goal URL data with visitor information and segment support.

Parameters: - idSite (int): Site ID - period (string): Period type ('day', 'week', 'month', 'year', 'range') - date (string): Date or date range - segment (string, optional): Matomo segment definition - limit (int, optional): Maximum number of rows to return (0 = no limit)

Example API call:

?module=API&method=EnhancedAttribution.getGoalUrlsDetailed&idSite=1&period=day&date=2025-05-15&format=json

Example return data:

[
  {
    "conversion_url": "https://carnaby.se/blog/google-this-and-that/",
    "channel": "social",
    "source": "facebook",
    "campaign_medium": "",
    "campaign_name": "",
    "goal_id": "2",
    "goal_name": "Newsletter Signup",
    "server_time": "2025-05-15 09:15:42",
    "date_s": "2025-05-15",
    "time_s": "09:15:42",
    "idvisit": "67890",
    "idvisitor": "x9y8z7w6v5u4321",
    "visitor_count_visits": "1",
    "visitor_returning": "new",
    "location_country": "us",
    "location_city": "New York",
    "config_os": "MAC",
    "config_browser_name": "SF",
    "config_device_type": "0"
  },
  {
    "conversion_url": "https://carnaby.se/article/vector-databases/",
    "channel": "direct",
    "source": "-",
    "campaign_medium": "",
    "campaign_name": "",
    "goal_id": "3",
    "goal_name": "Contact Form",
    "server_time": "2025-05-15 16:45:12",
    "date_s": "2025-05-15",
    "time_s": "16:45:12",
    "idvisit": "54321",
    "idvisitor": "m1n2o3p4q5r6890",
    "visitor_count_visits": "2",
    "visitor_returning": "returning",
    "location_country": "gb",
    "location_city": "London",
    "config_os": "IOS",
    "config_browser_name": "MF",
    "config_device_type": "1"
  }
]

Data Fields

The plugin enriches goal conversion data with the following fields:

  • Visitor Behavior: Visit count, returning visitor status, time since first visit
  • Geographic Data: Country, region, city
  • Technical Info: OS, browser, device type, screen resolution
  • Conversion Data: Goal URL, conversion timestamp, referrer information

Console Commands

test:goalurls-performance

Performance testing command for goal URL queries.

./console enhancedattribution:test-goalurls-performance

Development

Code linting

Composer is setup to support PHP-CS-Fixer, a powerful and widely-used tool, to automatically format code and ensure it adheres to modern coding standards like PSR-12.

composer format – This will automatically fix the coding style of your entire project. composer check-style – This will show you which files need formatting without actually modifying them, which is useful for continuous integration (CI) checks.

File Structure

  • EnhancedAttribution.php - Main plugin class with event registration
  • API.php - API methods for data retrieval
  • Commands/TestGoalUrlsPerformance.php - Performance testing command

Database Tables

The plugin primarily works with these Matomo tables: - matomo_log_conversion - Goal conversion data - matomo_log_visit - Visitor session data - matomo_log_link_visit_action - Page view actions

How is "Goal url" defined

The plugin use the traditional definion as used by other analytics suites: the URL of the page where a goal conversion occurs.

What data is used to determine the "Goal url"

The url field in the log_conversion table is used to determine the goal URL.

The Matomo Database Schema describe this as "the URL that caused this conversion to be tracked".

Why is MarketingCampaignsReporting required?

The campaign source and medium for each conversion are stored in columns that the MarketingCampaignsReporting plugin adds to the log_conversion table. Without it those columns don't exist, so Matomo won't let you activate EnhancedAttribution until MarketingCampaignsReporting is installed and activated.

Why does the report show only 100 rows?

Matomo's API returns at most 100 rows by default. Add filter_limit=-1 to get all conversions, or e.g. filter_limit=500 for a specific number.

Do I need to run archiving (core:archive) to see data?

No. The report reads conversions directly from Matomo's raw log tables, so new conversions show up right away, including today's.

Why don't old conversions show up anymore?

Because the report reads raw log data. If Regularly delete old raw data is enabled (Administration → Privacy → Anonymize data), conversions older than that limit are gone from this report, even though Matomo's archived Goals reports still show the totals.

Why are some conversions missing compared to the Goals report?

Only conversions with a recorded URL are included. Conversions tracked without a URL (for example server-side tracking that doesn't send url) are skipped. Also keep in mind that this report lists individual conversions, while the Goals reports show aggregated numbers.

Which attribution model is used for source and channel?

The one Matomo already uses for goal conversions: the referrer Matomo stored with the conversion. EnhancedAttribution doesn't re-attribute anything, it shows Matomo's attribution per conversion URL.

Can I use segments, including page segments like pageUrl=@/pricing?

Yes, all Matomo segments work, including action segments. A conversion is only listed once, even if several pages in the visit match the segment.

Can I use date=last30 or previous7?

Yes. Multiple-period dates (lastN, previousN) and period=range return all conversions in the whole span as one list.

Which plugin version do I need?

Matomo 6: version 2.x. Matomo 5: version 1.x. The Marketplace offers the right one automatically.

How do I get the data into Excel, Looker Studio or Power BI?

Use the API with format=csv (or json), filter_limit=-1 and a token_auth with view access to the site:

https://matomo.example.com/index.php?module=API&method=EnhancedAttribution.getGoalUrlsDetailed&idSite=1&period=month&date=2026-11-01&format=csv&filter_limit=-1&token_auth=YOUR_TOKEN

Will large date ranges be slow?

The report queries raw logs, so a full year on a busy site can take a while. Narrow it down with a segment or a shorter period. You can time the query with ./console enhancedattribution:test-performance --date=YYYY-MM-DD.

Does the report contain personal data?

It includes the visitor ID (idvisitor), city and the exact time of each conversion, so treat exports the way you treat other visitor-level data under GDPR. What the report shows depends on what Matomo has stored, so Matomo's anonymization settings apply here too.

View and download this plugin for a specific Matomo version:


Please share