Connect Matomo Analytics to a Joomla Site with Shack Analytics

Connect Matomo Analytics to a Joomla Site

One of the questions this week was about how to connect a Joomla site to "Matomo Analytics". "Matomo Analytics" is a server-side PHP/MySQL analytics self-hosted platform. It aims to be an Open Source alternative to Google Analytics.

You can quickly install it using your hosting control panel. In this blog post, I'll show you how to connect Matomo analytics software to your Joomla site using the Shack Analytics extension.


Step #1. Install Matomo

"Matomo Analytics" is a PHP/MySQL software. If you run a Joomla site, you can install "Matomo Analytics" on the same server. For my demonstration, I will show you how to install it under "cPanel".

Once you opened your hosting control panel, you want to click the "Polls and Analytics":

find polls and analytics

On the next screen, you want to click "Matomo":

click matomo

This will bring you to the "Matomo" installation screen. On this screen, you want to click the little arrow to the left of the "Install" button:

click on the little arrow

You will see the dropdown list of the installation options. You want to click "Quick Install":

click quick install

This will open a few new fields on your installation screen.

One of those new fields will be the "Choose Installation URL" with your site domain name. At this point, you are telling the "Matomo Analytics" installation script how you would like to call the installation folder. For my demonstration, I entered "matomo":

enter matomo as directory

The next field is the "Admin Username". Type in here your own admin username or leave the default "admin". For this blog, I entered "bxz35":

enter your admin username

One more new filed is the "Admin Password". To harden the security of your Matomo installation, replace the default "password" with a hard to guess password:

enter strong password

And the last field for you to fill in will be the "Admin Email". Here you can either leave the preset default admin email address or enter a different one:

enter your admin email

Now would be a good time to initiate the installation and click "Install":

click install

After a fearly brief screen activity, you should see the message stating that your installation was successful:

success message

Great! You are now one step away from getting your "Matomo Analytics" tracking code. To get it, you would want to visit the URL of your Matomo installation and log into your Matomo analytics administrator dashboard:

log into your matomo account

This would open your Matomo Dashboard. On the Dashboard, you want to find the "JavaScript Tracking Code" section and copy the code snippet:

copy the tracking code

Excellent! At this point, you are done on the "Matomo Analytics" side. You are now ready to move to your Joomla site to connect it to your Matomo analytics. 


Step #2. Create a Matomo global tracking tag in Shack Analytics

The "Shack Analytics" Joomla extension is really your Swiss Knife when it comes to connecting a Joomla site to external or server-side analytics tools. Let's connect your Joomla site to "Matomo".

In your Joomla administrator panel, you would go to "Components" > "Shack Analytics Pro":

go to components shack analytics pro

This will bring you to the "Shack Analytics: Tracking Tags" screen. In the top left corner, you would click "New" to create a new tracking tag:

click new

This will open the "Shack Analytics: New Tracking Tag" page. You want to enter "Matomo" or something similar into the "Title" field and paste the code you copied in the previous step into the "Header Custom Code" box:

paste matomo js code

Now would be a good time to click "Save & Close". You should see your newly created tag listed:

your newly created tracking tag listed

So far so good. You have created your Matomo tracking tag but you have not applied it to your Joomla site yet. To rectify this, let's assign this tag as a global tag for your Joomla site.

In the top right corner, you want to click "Options":

click options

This will open for you the "Shack Analytics: Configuration" screen. Here you want to click inside the "Global Tracking Tag" box and then - on your Matomo tag:

click on your matomo tag

You should see your Matomo tracking tag sitting pretty inside the "Global Tracking Tag" box:

matomo tag inside the box

Now would be a perfect time to click "Save" or "Save & Close".

Go and check the HTML source code of your Joomla site. You should see the JaveScript code snippet from your Matomo installation embedded between the opening <head> and closing </head> tags:

matomo tracking tag in the source html

Excellent! Your Joomla site is now connected to your Matomo analytics installation. You are well on your way to become a data wizard!


What's Next?

Save $1000's when you sign up to Joomlashack's Everything Club.

You will get access to all our 31 extensions, templates, and Joomla training.

  Click here to join the Everything Club


About the author

Alex is a self-taught Microsoft Certified Professional based in England. He enjoys learning Joomla and helping beginners and web site administrators make the most of it.