Matomo: 4. Create the service
This documentation is part of the Automate with the CLI guide. View the full guide here: Start Matomo, retrieve its credentials, and change its configuration programmatically with the Stackhero CLI.
👋 Welcome to the Stackhero documentation!
Stackhero provides a Matomo cloud solution that streamlines web analytics:
- Unlimited websites, members, segments, goals, and data retention: track everything you need, for as long as you need it.
- Effortless updates: keep your analytics platform current with a single click.
- Custom domain name with HTTPS: run Matomo at a secure, branded URL, such as https://analytics.your-company.com.
- High performance and strong security: your data runs on private, dedicated infrastructure for reliability and privacy.
With Stackhero, you can launch Matomo analytics in minutes and manage all your sites from one place. Try our Matomo cloud hosting to simplify analytics and focus on what matters.
Here is a sample script that creates a stack, adds your Matomo service to it, waits for it to start, retrieves its configuration (including generated credentials), and then applies a new configuration.
#!/bin/bash
set -e
export STACKHERO_TOKEN="usr-xxxxxx:your-token"
serviceStore="matomo" # The Matomo service store name (see step 2)
instance="..." # An instance size from step 3
region="europe" # A region name from step 3
# Create a stack for your service (uses your default organization; add --organization if needed)
stackId=$(stackhero --format=script stack-create \
--name="My Matomo stack")
echo "Stack created: ${stackId}"
# Add Matomo to the stack (names are resolved automatically)
serviceId=$(stackhero --format=script service-add \
--stack="My Matomo stack" \
--service-store="${serviceStore}" \
--instance="${instance}" \
--region="${region}")
echo "Service added: matomo"
# Wait for the service to be fully running (this may take a couple of minutes)
stackhero service-wait-for --service="matomo"
# Retrieve the service configuration, including generated credentials
stackhero service-configuration-get --service="matomo" --format=json