-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
314b39b
commit 887690d
Showing
20 changed files
with
84 additions
and
1,059 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
oereb_client/static/src/component/matomo_tracker/matomo_tracker.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import PropTypes from 'prop-types'; | ||
import React, {useEffect} from 'react'; | ||
|
||
const MatomoTracker = ({matomoUrl, siteId}) => { | ||
useEffect(() => { | ||
const script = document.createElement('script'); | ||
script.type = 'text/javascript'; | ||
script.async = true; | ||
script.defer = true; | ||
script.src = `${matomoUrl}/matomo.js`; | ||
document.body.appendChild(script); | ||
window._paq = window._paq || []; | ||
window._paq.push(['trackPageView']); | ||
window._paq.push(['enableLinkTracking']); | ||
window._paq.push(['setTrackerUrl', `${matomoUrl}/matomo.php`]); | ||
window._paq.push(['setSiteId', siteId]); | ||
}, [matomoUrl, siteId]); | ||
return null; | ||
}; | ||
|
||
MatomoTracker.propTypes = { | ||
matomoUrl: PropTypes.string.isRequired, | ||
siteId: PropTypes.number.isRequired | ||
}; | ||
|
||
export default MatomoTracker; |
18 changes: 18 additions & 0 deletions
18
oereb_client/static/src/component/matomo_tracker/matomo_tracker.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import {Meta} from '@storybook/blocks'; | ||
|
||
<Meta title="API Reference/Component/MatomoTracker" /> | ||
|
||
# App | ||
|
||
A hidden component enabling user tracking using Matomo. | ||
|
||
```jsx | ||
<MatomoTracker matomoUrl={matomoUrl} siteId={siteId} /> | ||
``` | ||
|
||
### Parameters | ||
|
||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| matomoUrl | <code>String</code> | The URL of the Matomo instance. | | ||
| siteId | <code>Number</code> | The ID of the Site configured in Matomo. | |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.