A demo site for testing various page metrics scripts
Website link.
- Webserver such as Apache, Nginx, IIS, etc.
- PHP version 5.5.9 or greater
- MySQL version 5.5 or greater, or MariaDB
- (enabled by default) PHP extension pdo and pdo_mysql, or the mysqli extension.
-
PHP 7 (more memory efficient and faster than previous PHP versions)
-
MySQL 5.7+ or MariaDB for database
-
few extra PHP extensions: PHP GD extension
$ sudo apt-get install php7.0 php7.0-curl php7.0-gd php7.0-cli mysql-server php7.0-mysql php-xml php7.0-mbstring
- Download the self-hosted Matomo source codes from here. A mirror download as of this writing, version 3.6.0 is available here.
- Extract the contents into your webserver, example:
http://localhost/analytics
. - Run the website to initialize your first website url to track by loading
http://localhost/analytics
.
- Login to PhpMyAdmin
- Create a database that you will use for Matomo
- Create a database user with a password
-
Fill in the required fields (some of them may need to get details from your MySQL database).
-
If you run into an error
Matomo reports this error and doesn’t continue: “Fatal error: Maximum execution time of 30 seconds exceeded in …
, change yourphp.ini
'smax_execution_time=30
to0
and try again.
-
Welcome
Welcome introductory page. -
System Check
This page checks if your system requirements are met by your machine. -
Database Setup
- Database Server: 127.0.0.1 / localhost
- Login: <YOUR_DB_USERNAME>
- Password: <YOUR_DB_USER_PASSWORD>
- Database Name: <YOUR_DATABASE_NAME>
- Table Prefix: (Leave as ease or change)
- Adapter: PDO\MYSQL
-
Super User
- Super user login: (create a random super user login name)
- Password: Create a password
- Password (repeat): repeat password
- Email: enter a valid email
-
Setup a Website
- Website name: Enter your website-to-track's name
- Website URL: Enter your website-to-track's URL
- Website time zone: Enter your country
- Ecommerce: Select Not an Ecommerce site
-
Javascript Tracking Code
- Copy the printed JavaScript Tracking Code, paste between website's
<head></head>
tag.
- Copy the printed JavaScript Tracking Code, paste between website's
-
Congratulations
- congrats! First website tracking code and set-up is finished
- Press Continue to Matomo button
An Anonymous user will be used to view your account's data publicly without logging into your Matomo instance.
- Go to Administration (gear icon on upper right) > System > Users
- Set anonymous user's Role for <website_name> to View
- Go to Administration > Anonymous user > Anonymous user settings
- Dashboard for a specific website = Offline Website
- For anonymous users, report date to load by default = Las 7 days (including today)
- Set the not logged-in view for anonymous users
- Go to System > Anonymous user
- Inside the Anonymous user settings set:
- When users are not logged in and visit Matomo, they should access = The login screen
-
GeoLocation
- Go to Administration (gear icon on upper right) > System > Geolocation
- Download the GeoIP 2 (Apache) free databases from the following links. City is recommended to be used.
- GeoLite2 City - binary | csv | mirror all format
- GeoLite2 Country - binary | csv | mirror all format
- GeoLite2 ASN - binary | csv | mirror all format
- Extract the content of GeoLite2-City_20180905.tar. Copy the extracted GeoLite2-City.mmdb into
/PATH_TO_MATOMO/misc/
- Refresh the browser page, then press Save.
-
Use SSL (https) - ForceSSL
-
Forces to serve data and content over SSL
-
Download and install the ForceSSL plugin from here or mirror link here. Extract contents to
<PATH_TO_MATOMO>/plugins/ForceSSL
-
Alternatively, you can edit your
config/config.ini.php
/global.ini.php
file and add under the[General]
section, set the following:[General] force_ssl = 1
-
for more information, read complete instructions from here.
-
-
Open
config/global.ini.php
-
Edit the following lines:
[General] cors_domains[] = *
-
to allow CORS only on specific websites
[General] cors_domains[] = "http://example.com" cors_domains[] = "http://dashboard.example.com"
The following script will track a webpage when embedded between the <head></head>
part.
- Login using your created user credentials during first-time initialization to your hosted Matomo at
http://localhost/analytics
- Click the Administration link (gear icon) on the upper right topbar menu.
- Navigate to the sidebar.
- Go to Websites > Manage
- Press the Add a New Website button
- Fill in the input fields, answering only the input fields from the default website initialization. Other input fields may be explored later.
The following script will track a webpage when embedded between the <head></head>
part.
- Login using your created user credentials during first-time initialization to your hosted Matomo at
http://localhost/analytics
- Click the Administration link (gear icon) on the upper right topbar menu.
- Navigate to the sidebar.
- Go to Websites > Manage
- Select a website row, then click View Tracking Code
- Scroll down and copy the script under JavaScript Tracking Code into the
<head></head>
part of your website.
- Go to Administration (gear icon on upper right) > Platform > Widgets
- Go to Widgetize reports
- Select Visitors > Visitors Overview (with Graph)
- Copy the
Embed iframe
ordirect link
codes into your website. - (OPTIONAL) Disable Annotations for anonymous users
- Go to Administration > System > Plugins
- Find the Annotations plugin and disable it