Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/5.x/media-analytics/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ window.matomoAsyncInit = function () {
It is important to define these methods before the Piwik tracker file is loaded. Otherwise, your `matomoAsyncInit`
or `matomoMediaAnalyticsAsyncInit` method will never be called.

In order to use your additional tracker(s) outside the `matomoAsyncInit` function, you will need to declare the tracker name as a global variable. For example:

```js
var matomoTracker1;
window.matomoAsyncInit = function () {
matomoTracker1 = Matomo.getTracker('https://example.com/matomo.php', 1);
}
```
This will then allow the added tracker to be used for tracking events, such as link clicks:

```js
onclick="matomoTracker1.trackEvent('Test Events', 'Click', 'Clicked X', 0);"
```

## Is it possible to not use the "paq.push" methods and instead call the MediaAnalytics tracker methods directly?

Yes. To initialize the Media tracker you need to define a callback method `window.matomoMediaAnalyticsAsyncInit`
Expand Down
1 change: 1 addition & 0 deletions docs/5.x/tracking-javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ Matomo provides a mechanism to manage your user's tracking consent. You can requ
* `hasRememberedConsent()` - Returns true or false depending on whether the current visitor has given consent previously or not.
* `getRememberedConsent()` - If consent was given, returns the timestamp when the visitor gave consent. Only works if `rememberConsentGiven` was used and not when `setConsentGiven` was used. The timestamp is the local timestamp which depends on the visitors time.
* `isConsentRequired()` - Returns true or false depending on whether `requireConsent` was called previously.
* `hasConsent()` - Returns true if tracking is enabled for the visitor (regardless of cookie consent), false if tracking is disbaled for the visitor via `forgetConsentGiven()` or another method.

Matomo also provides a mechanism to manage your user's cookie consent. You can require that users consent to using cookies. Tracking requests will be always sent but depending on the consent cookies will be used or not used.

Expand Down