You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ This is useful for users who track multiple websites on the same Matomo server,
11
11
To run this properly you will need:
12
12
13
13
- latest version of Matomo installed on a server (or Matomo Cloud)
14
-
- one or several website(s) to track with this Matomo, for example `http://trackedsite.com`
14
+
- one or several website(s) to track with this Matomo, for example `http://{site_to_be_tracked}`
15
15
- the website to track must run on a server with PHP 5.3 or higher
16
16
- PHP must have either the CURL extension enabled or `allow_url_fopen=On`
17
17
@@ -36,20 +36,20 @@ You need to install the proxy on the server where your websites are hosted. You
36
36
37
37
|:zap: Important note about where to install the proxy |
38
38
|-----------------------------------------|
39
-
| To ensure the highest data accuracy possible, and that your Matomo cookies are set correctly, please install the proxy in your main website domain name and web server. This proxy should be ideally installed on your webserver directly under `trackedsite.com`. If you installed the proxy in a sub-domain under `analytics.trackedsite.com` then this would cause data to be less accurate. (Why? because if the sub-domain `analytics.trackedsite.com` was to resolve to a CNAME that does _not_ match `trackedsite.com` OR if it was to resolve to A/AAAA addresses that do not match the first half of the A/AAAA addresses running `trackedsite.com`, then the cookies set by the Matomo Tracker Proxy in the response would only have a lifetime of maximum 7 days on Safari >= 16.4.) |
39
+
| To ensure the highest data accuracy possible, and that your Matomo cookies are set correctly, please install the proxy in your main website domain name and web server. This proxy should be ideally installed on your webserver directly under `{site_to_be_tracked}`. If you installed the proxy in a sub-domain under `analytics.{site_to_be_tracked}` then this would cause data to be less accurate. (Why? because if the sub-domain `analytics.{site_to_be_tracked}` was to resolve to a CNAME that does _not_ match `{site_to_be_tracked}` OR if it was to resolve to A/AAAA addresses that do not match the first half of the A/AAAA addresses running `{site_to_be_tracked}`, then the cookies set by the Matomo Tracker Proxy in the response would only have a lifetime of maximum 7 days on Safari >= 16.4.) |
40
40
41
41
#### Manual download of `matomo.php`
42
42
43
43
- download [`matomo.php`](https://raw.githubusercontent.com/matomo-org/tracker-proxy/master/matomo.php), download [`piwik.php`](https://raw.githubusercontent.com/matomo-org/tracker-proxy/master/piwik.php), [`proxy.php`](https://raw.githubusercontent.com/matomo-org/tracker-proxy/master/proxy.php), [`matomo-proxy.php`](https://raw.githubusercontent.com/matomo-org/tracker-proxy/master/matomo-proxy.php) & if you are using the Heatmaps and Session recordings plugin also download [`plugins/HeatmapSessionRecording/configs.php`](https://raw.githubusercontent.com/matomo-org/tracker-proxy/master/plugins/HeatmapSessionRecording/configs.php)
44
-
to your website root directory, for example at `http://trackedsite.com/matomo.php`, `http://trackedsite.com/piwik.php`, `http://trackedsite.com/proxy.php`, `http://trackedsite.com/matomo-proxy.php` & `http://trackedsite.com/plugins/HeatmapSessionRecording/configs.php`
44
+
to your website root directory, for example at `http://{site_to_be_tracked}/matomo.php`, `http://{site_to_be_tracked}/piwik.php`, `http://{site_to_be_tracked}/proxy.php`, `http://{site_to_be_tracked}/matomo-proxy.php` & `http://{site_to_be_tracked}/plugins/HeatmapSessionRecording/configs.php`
45
45
- edit the file to set the configuration variables:
46
46
-`$MATOMO_URL` should contain the URL to your Matomo server
47
47
-`$PROXY_URL` should contain the URL to the tracker-proxy server
48
48
-`$TOKEN_AUTH` should contain the `token_auth`
49
49
50
50
#### With git
51
51
52
-
- clone the repository: `git clone https://github.com/matomo-org/tracker-proxy.git matomo` into your website root directory (for example at `http://trackedsite.com/matomo/matomo.php`)
52
+
- clone the repository: `git clone https://github.com/matomo-org/tracker-proxy.git matomo` into your website root directory (for example at `http://{site_to_be_tracked}/matomo/matomo.php`)
53
53
- copy the configuration template: `cp config.php.example config.php`
54
54
- change the configuration in the newly created `config.php`:
55
55
-`$MATOMO_URL` should contain the URL to your Matomo server
@@ -62,7 +62,7 @@ Be aware that with this method, `matomo.php` and other files are in a `matomo/`
62
62
63
63
### 3. Use the proxy in the Javascript tracker
64
64
65
-
The proxy file (`http://trackedsite.com/matomo.php`) will be called by the Matomo Javascript tracker instead of calling directly the (secret) Matomo server (`http://your-matomo-domain.example.org/matomo/`).
65
+
The proxy file (`http://{site_to_be_tracked}/matomo.php`) will be called by the Matomo Javascript tracker instead of calling directly the (secret) Matomo server (`http://your-matomo-domain.example.org/matomo/`).
66
66
67
67
To achieve this, change the Matomo Javascript Code that is in the footer of your pages:
68
68
@@ -72,7 +72,7 @@ To achieve this, change the Matomo Javascript Code that is in the footer of your
72
72
```javascript
73
73
[...]
74
74
(function() {
75
-
var u="//trackedsite.com/";
75
+
var u="//{site_to_be_tracked}/";
76
76
_paq.push(["setTrackerUrl", u+"matomo.php"]);
77
77
_paq.push(["setSiteId", "tracked-site-id-here"]);
78
78
var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0];
@@ -84,14 +84,14 @@ To achieve this, change the Matomo Javascript Code that is in the footer of your
84
84
85
85
What has changed inthis code snippet compared to the normal Matomo code?
86
86
87
-
- any reference(s) to the secret Matomo URL are now replaced by your website URL (the proxy).
87
+
- any reference(s) to the secret Matomo URL are now replaced by your website URL (the proxy).
88
88
-`matomo.js` becomes `matomo.php` (or `matomo/matomo.php`if you used the *git* method):matomo.php is the proxy script
89
89
- make sure to replace `tracked-site-id-here`with your idsite
90
90
-if the `<noscript>` is present in your tracking code, you can remove it (it contains the secret Matomo URL which you want to hide)
91
91
92
92
- paste the modified Matomo Javascript code in the pages you wish to track.
93
93
94
-
This modified Javascript code will then track visits/pages/conversions by calling `trackedsite.com/matomo.php`, which will then automatically call your (hidden) Matomo Server URL.
94
+
This modified Javascript code will then track visits/pages/conversions by calling `{site_to_be_tracked}/matomo.php`, which will then automatically call your (hidden) Matomo Server URL.
95
95
96
96
At this stage, example.com should be tracked by your Matomo without showing the Matomo server URL. Repeat the step 3.for each website you wish to track in Matomo.
97
97
@@ -106,12 +106,12 @@ _Note: you can get the opt out iframe from inside the Administration > Privacy >
106
106
107
107
### Timeout
108
108
109
-
By default, the `matomo.php` proxy will wait 5 seconds for the Matomo server to return the response.
109
+
By default, the `matomo.php` proxy will wait 5 seconds for the Matomo server to return the response.
110
110
You may change this timeout by editing the `$timeout` value in`config.php`.
111
-
111
+
112
112
### User-Agent
113
-
114
-
By default, the `matomo.php` proxy will contact your Matomo server with the User-Agent of the client requesting `matomo.php`.
113
+
114
+
By default, the `matomo.php` proxy will contact your Matomo server with the User-Agent of the client requesting `matomo.php`.
115
115
You may force the proxy script to use a particular User-Agent by editing the `$user_agent` value in`config.php`.
0 commit comments