Matomo Tag Manager for Google Ads
- Embedding Multiple Matomo Containers
- Reusing Matomo Containers Across Websites
- Self-Hosting Matomo Container JavaScript
- Creating and Contributing Custom Tags
- Integrating Matomo Tag Manager with Google Ads
- Matomo Tag Manager API and Development Resources
- Handling Matomo Configuration Variables in Tag Manager
- Ensuring Quality with Matomo JavaScript Unit Tests
Integrate Google Ads with ease using Matomo Tag Manager. Streamline your ad tracking and optimization.
Embedding Multiple Matomo Containers
Embedding multiple Matomo containers on a single website allows for granular management of tracking and analytics by different teams. For instance, one team can handle all advertising-related tags while another manages general site analytics. To implement multiple containers, simply place the embed codes for each container sequentially within your site's code, ideally in the
<head>
section for optimal performance.
Subheadings and Structured Content
Code Example
<!-- Matomo Tag Manager Container 1 -->
<script type="text/javascript">/* Container 1 code */</script>
<!-- Matomo Tag Manager Container 2 -->
<script type="text/javascript">/* Container 2 code */</script>
Unique Insights
Leverage official documentation to provide insights into best practices for embedding multiple containers, such as maintaining separate concerns for different teams and updating JavaScript files on your server to avoid ad blockers.
Was this helpful?
Related Documentation
-
Matomo Docker Integration Guide
Learn how to integrate Matomo with Docker for efficient web analytics. Ideal for DevOps and data-driven teams.
-
Matomo Docker Compose Guide
Learn to integrate Matomo with Docker Compose for efficient web analytics setup and deployment.
-
Matomo Docker Nginx Integration Guide
Learn how to integrate Matomo with Docker and Nginx for efficient web analytics. Streamline your setup with our tips.
-
Matomo integration with Google Tag Manager
Learn how to seamlessly integrate Matomo analytics with Google Tag Manager for enhanced tracking.
Reusing Matomo Containers Across Websites
Matomo Tag Manager supports the use of a single container across multiple websites, streamlining tag management for various teams. For instance, one team can manage advertising-related containers, while another handles different tags. To implement this, simply embed the container codes into your websites, placing them consecutively for optimal performance.
Embedding Container Codes
Embedding the same Matomo container across different websites is straightforward. Place the following code snippet into the HTML of each website, ideally within the
<head>
tag for faster loading:
<!-- Matomo Tag Manager -->
<script type="text/javascript">
window._mtm = window._mtm || [];
window._mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
(function() {
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true;
g.src='https://your-matomo-domain.com/js/container_yourContainerID.js';
s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Tag Manager -->
Replace your-matomo-domain.com
with your actual Matomo URL and yourContainerID
with the specific container ID you wish to use.
Handling Ad Blockers
Ad blockers may prevent the loading of Matomo containers. To mitigate this, download the container's JavaScript file and host it on your own server. Note that this approach disables the debug/preview feature and requires manual updates after each container release.
Integration with Google Ads
When integrating Matomo with Google Ads, ensure that the relevant tags are configured within your Matomo container. This allows for seamless tracking and management of advertising campaigns across multiple websites using a single container.
Best Practices
Keep your container codes updated and in sync across all websites.
Regularly review and optimize the tags within your container to ensure they are functioning as intended.
Utilize the official Matomo documentation for specific insights and to stay informed about best practices and new features.
Was this helpful?
Related Documentation
Related Documentation
-
Matomo Docker Integration on GitHub
Explore the seamless integration of Matomo analytics with Docker on GitHub for efficient tracking.
-
Matomo Docker Integration Guide
Learn how to integrate Matomo with Docker for efficient web analytics. Ideal for DevOps and data-driven teams.
-
Matomo Docker HTTPS Setup Guide
Learn how to configure HTTPS for Matomo on Docker. Secure your analytics with best practices and SSL.
-
Matomo Docker-Compose Setup Guide
Learn how to configure Matomo with Docker-Compose. Essential tips for efficient web analytics deployment.
Self-Hosting Matomo Container JavaScript
Self-Hosting Matomo Container JavaScript
Self-hosting Matomo's container JavaScript allows for greater control over the analytics tracking process. This approach is particularly beneficial when integrating Matomo Tag Manager with Google Ads or other advertising platforms. By hosting the container JavaScript on your own server, you can mitigate issues related to third-party script blockers, ensuring more reliable data collection.
Benefits of Self-Hosting
Improved Performance
: Hosting the container JavaScript locally can reduce external HTTP requests, potentially improving page load times.
Ad Blocker Avoidance
: Self-hosted scripts are less likely to be blocked by ad blockers, increasing the accuracy of analytics data.
Customization
: You have the flexibility to customize the opt-out form language and other settings without relying on Matomo's servers.
Implementation Steps
Download the container JavaScript file from your Matomo URL.
Upload the file to your server, ensuring it's accessible via HTTPS.
Update your website's code to reference the self-hosted JavaScript file.
<script type="text/javascript" src="/path/to/your/container_{$CONTAINER_ID}.js" async="true" defer="true"></script>
Replace /path/to/your/
with the actual path to the script on your server, and {$CONTAINER_ID}
with your specific container ID.
Considerations
Remember to update the self-hosted JavaScript file whenever you publish a new version to your Matomo environment.
The debug/preview feature may not work out of the box with self-hosted scripts.
By following these steps, you can effectively integrate Matomo's container JavaScript into your website, enhancing your analytics capabilities while maintaining control over the tracking process.
Was this helpful?
Related Documentation
Related Documentation
-
Matomo integration with Google Tag Manager
Learn how to seamlessly integrate Matomo analytics with Google Tag Manager for enhanced tracking.
-
Matomo GitHub Docker Integration
Explore the seamless integration of Matomo with Docker via GitHub. Efficient analytics setup for developers.
-
Matomo Docker HTTPS Setup Guide
Learn how to configure HTTPS for Matomo on Docker. Secure your analytics with best practices and SSL.
-
Matomo Nginx Docker Integration Guide
Learn how to seamlessly integrate Matomo with Nginx on Docker. Optimize your analytics with this technical walkthrough.
Creating and Contributing Custom Tags
Creating and Contributing Custom Tags
Custom tags in Matomo Tag Manager allow for the execution of user-defined scripts and integration with various services like Google Ads. To create a custom tag, you'll need a development environment set up with Matomo and the Tag Manager plugin activated. Here's a step-by-step guide:
Environment Setup
Ensure you have Matomo 3.7.0 or later with the Tag Manager plugin enabled.
Familiarize yourself with the general setting up guide.
Development Process
Create a new plugin or use an existing one to house your custom tag.
Follow the structure for tags as outlined in the Tag Manager Developer Guides.
Contribution Guidelines
If your custom tag could benefit the wider Matomo community, consider contributing it to the
official Tag Manager plugin
.
For more niche tags, you can release them on the
Matomo Marketplace
.
Testing and Maintenance
Test your tag thoroughly to ensure compatibility and performance across different browsers.
Keep your tag updated with any changes in the Matomo Tag Manager API.
By contributing to the Matomo ecosystem, you enhance the flexibility and functionality of Matomo Tag Manager for all users.
Was this helpful?
Related Documentation
Related Documentation
-
Matomo Tag Manager on GitHub
Explore the integration of Matomo Tag Manager with GitHub. Delve into the technical setup and benefits for developers.
-
Getting started with Matomo analytics
Learn the basics of Matomo, the open-source analytics platform, and how to effectively track your website's data.
-
Matomo integration with Google Tag Manager
Learn how to seamlessly integrate Matomo analytics with Google Tag Manager for enhanced tracking.
-
Matomo environment variables guide
Explore essential Matomo environment variables for efficient web analytics configuration and management.
Integrating Matomo Tag Manager with Google Ads
Integrating Matomo Tag Manager with Google Ads
Integrating Matomo Tag Manager with Google Ads allows for precise tracking and data collection, enhancing the performance of your advertising campaigns. To begin, ensure that the Matomo Tag Manager plugin is activated on your site. Create a new tag within the Matomo interface, selecting 'Google Ads' as the tag type. Configure the tag by entering your Google Ads conversion ID and conversion label.
Setting Up Triggers
Triggers determine when your tag should fire. For Google Ads conversion tracking, you might set a trigger for when a user completes a purchase or submits a contact form. Use the Matomo Tag Manager's built-in triggers or create custom ones to match your specific needs.
Variables and Data Layer
Variables can be used to dynamically pass information, such as transaction values, to your Google Ads tag. Utilize the data layer to push events and values from your website into Matomo Tag Manager, making this data available for your tags and triggers.
Testing and Publishing
Before going live, use the Matomo Tag Manager's preview and debug mode to test your tags and triggers. Ensure that they are firing correctly and sending data to Google Ads. Once verified, publish the container to apply the changes to your live site.
By following these steps and leveraging the official documentation, you can effectively integrate Matomo Tag Manager with Google Ads, leading to more informed decisions and optimized ad spend.
Was this helpful?
Related Documentation
Related Documentation
-
Matomo Google Ads Integration Guide
Explore the seamless integration of Matomo with Google Ads for enhanced tracking and analytics capabilities.
-
Matomo.js Blocked Issues - Troubleshooting
Learn how to identify and resolve issues when Matomo.js is blocked, ensuring accurate analytics tracking.
-
Matomo integration with Google Tag Manager
Learn how to seamlessly integrate Matomo analytics with Google Tag Manager for enhanced tracking.
-
Matomo mit Google Ads verknüpfen
Erfahren Sie, wie Sie Matomo effektiv mit Google Ads für verbesserte Tracking- und Analysefunktionen verknüpfen.
Matomo Tag Manager API and Development Resources
Matomo Tag Manager API and Development Resources
Matomo Tag Manager is a powerful tool for managing and deploying analytics and marketing tags on your website. It simplifies the process of adding, updating, and maintaining tags, making it easier to integrate services like Google Ads into your analytics workflow.
Key Features
Asynchronous Tag Loading
: Ensures your site's performance is not hindered by tag loading.
User-friendly Interface
: Manage tags without needing to edit code directly.
Version Control
: Keep track of changes and roll back to previous versions if necessary.
Debugging Tools
: Test and debug your tags to ensure they are firing correctly.
Integrating with Google Ads
To integrate Matomo Tag Manager with Google Ads, follow these steps:
Create a new tag for Google Ads within the Matomo Tag Manager interface.
Configure the tag with your Google Ads conversion ID and label.
Set up triggers to determine when the tag should fire, such as on a page view or a specific event like a form submission.
API References
For developers looking to dive deeper, Matomo provides comprehensive API references:
The JavaScript Tag Manager API Reference offers detailed information on how to interact with the tag manager programmatically.
The HTTP API Reference provides endpoints for managing tags, triggers, and variables server-side.
Custom Development
If you need to create custom tags or templates, refer to the official documentation for guidance on developing within the Matomo ecosystem. Remember to test your custom code thoroughly and consider contributing to the Matomo community if your solutions could benefit others.
Was this helpful?
Related Documentation
Related Documentation
-
Matomo integration with Google Tag Manager
Learn how to seamlessly integrate Matomo analytics with Google Tag Manager for enhanced tracking.
-
Matomo vs Plausible analytics comparison
In-depth comparison of Matomo and Plausible analytics platforms focusing on privacy, features, and usability.
-
Matomo vs AWStats comparison
Explore the technical differences between Matomo and AWStats for web analytics. Understand features, privacy, and usability.
-
Matomo GitHub Integration Guide
Explore the seamless integration of Matomo with GitHub for enhanced tracking and analytics capabilities.
Handling Matomo Configuration Variables in Tag Manager
Handling Matomo Configuration Variables in Tag Manager
When integrating Matomo Tag Manager with Google Ads or other platforms, it's crucial to manage configuration variables effectively. Here's a step-by-step guide:
Accessing Configuration Variables
Use the Matomo Tag Manager interface to create and manage variables.
Variables can be used to store data like user IDs, session information, or campaign details.
Implementing Variables in Tags
In the tag configuration, select the variable from the dropdown menu.
Variables can dynamically alter tag behavior based on their values.
Testing and Debugging
Utilize the Matomo Tag Manager's preview mode to test variables.
Check that variables are being populated correctly and that tags are firing as expected.
Advanced Use Cases
For complex scenarios, such as e-commerce tracking, use custom JavaScript variables.
These variables can capture transaction details and pass them to tags for sophisticated tracking.
By following these practices, you can ensure that your Matomo Tag Manager setup is robust and that your tracking data is accurate and reliable.
Was this helpful?
Related Documentation
Related Documentation
-
Matomo GitHub Integration Guide
Explore the seamless integration of Matomo with GitHub for enhanced tracking and analytics capabilities.
-
Matomo Analytics GitHub Integration
Explore the integration of Matomo Analytics with GitHub for enhanced tracking and data insights.
-
Matomo.js Blocked Issues - Troubleshooting
Learn how to identify and resolve issues when Matomo.js is blocked, ensuring accurate analytics tracking.
-
Matomo integration with Google Tag Manager
Learn how to seamlessly integrate Matomo analytics with Google Tag Manager for enhanced tracking.
Ensuring Quality with Matomo JavaScript Unit Tests
Ensuring Quality with Matomo JavaScript Unit Tests
Matomo's JavaScript unit testing is a critical component in maintaining the reliability and integrity of the Matomo analytics platform. By leveraging QUnit for test writing, developers can ensure that the JavaScript tracking API (
matomo.js
) remains robust against regressions and bugs. Here's how to enhance the quality of your Matomo implementation with effective JavaScript unit tests.
Writing Tests
To write a new test, create a file in your plugin directory at
tests/javascript/index.php
. Structure your tests to cover individual functionalities of your plugin. For example:
<script type="text/javascript">
module('MyPlugin');
test("Matomo MyPlugin", function() {
expect(2);
equal(typeof Matomo.MyPlugin, 'object', 'MyPlugin');
var MyPlugin = Matomo.MyPlugin;
equal(typeof MyPlugin.disableTracking, 'object', 'MyPlugin.disableTracking');
</script>
Running Tests
To run the tests, navigate to /path/to/matomo/tests/javascript/
in your browser or use the command line with ./console tests:run-js
. Ensure your Matomo instance is correctly configured, especially the [database_tests]
section in config.ini.php
.
Cross-Browser Compatibility