Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ecolyo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
Ecolyo
Commits
4c911e62
Commit
4c911e62
authored
3 years ago
by
Yoan VALLET
Browse files
Options
Downloads
Patches
Plain Diff
feat: handle remote url for matomo
parent
958098c7
No related branches found
No related tags found
2 merge requests
!624
Feat/us780 matomo opt out
,
!515
Feat/us675 matomo
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/targets/browser/index.tsx
+1
-0
1 addition, 0 deletions
src/targets/browser/index.tsx
src/utils/matomoTracker.ts
+12
-1
12 additions, 1 deletion
src/utils/matomoTracker.ts
with
13 additions
and
1 deletion
src/targets/browser/index.tsx
+
1
−
0
View file @
4c911e62
...
@@ -61,6 +61,7 @@ const setupApp = memoize(() => {
...
@@ -61,6 +61,7 @@ const setupApp = memoize(() => {
Piwik
.
getTracker
()
Piwik
.
getTracker
()
const
tracker
=
new
MatomoTracker
({
const
tracker
=
new
MatomoTracker
({
cozyUrl
:
cozyUrl
,
url
:
__PIWIK_TRACKER_URL__
,
url
:
__PIWIK_TRACKER_URL__
,
siteId
:
__PIWIK_SITEID__
,
siteId
:
__PIWIK_SITEID__
,
history
:
history
,
history
:
history
,
...
...
This diff is collapsed.
Click to expand it.
src/utils/matomoTracker.ts
+
12
−
1
View file @
4c911e62
...
@@ -2,6 +2,7 @@ import { History, Location, UnregisterCallback } from 'history'
...
@@ -2,6 +2,7 @@ import { History, Location, UnregisterCallback } from 'history'
import
{
readCozyDataFromDOM
}
from
'
cozy-ui/transpiled/react/helpers/appDataset
'
import
{
readCozyDataFromDOM
}
from
'
cozy-ui/transpiled/react/helpers/appDataset
'
interface
InitSettings
{
interface
InitSettings
{
cozyUrl
:
string
url
:
string
url
:
string
siteId
:
number
siteId
:
number
history
:
History
history
:
History
...
@@ -15,6 +16,7 @@ declare global {
...
@@ -15,6 +16,7 @@ declare global {
}
}
export
default
class
MatomoTracker
{
export
default
class
MatomoTracker
{
cozyUrl
:
string
url
:
string
url
:
string
siteId
:
number
siteId
:
number
phpFilename
:
string
phpFilename
:
string
...
@@ -23,6 +25,7 @@ export default class MatomoTracker {
...
@@ -23,6 +25,7 @@ export default class MatomoTracker {
unlistenFromHistory
:
UnregisterCallback
unlistenFromHistory
:
UnregisterCallback
constructor
({
constructor
({
cozyUrl
,
url
,
url
,
siteId
,
siteId
,
history
,
history
,
...
@@ -33,6 +36,7 @@ export default class MatomoTracker {
...
@@ -33,6 +36,7 @@ export default class MatomoTracker {
'
MatomoTracker cannot be initialized! SiteId and url are mandatory.
'
'
MatomoTracker cannot be initialized! SiteId and url are mandatory.
'
)
)
}
}
this
.
cozyUrl
=
cozyUrl
this
.
url
=
url
this
.
url
=
url
this
.
siteId
=
siteId
this
.
siteId
=
siteId
this
.
phpFilename
=
phpFilename
this
.
phpFilename
=
phpFilename
...
@@ -48,6 +52,9 @@ export default class MatomoTracker {
...
@@ -48,6 +52,9 @@ export default class MatomoTracker {
if
(
url
.
indexOf
(
'
http://
'
)
!==
-
1
||
url
.
indexOf
(
'
https://
'
)
!==
-
1
)
{
if
(
url
.
indexOf
(
'
http://
'
)
!==
-
1
||
url
.
indexOf
(
'
https://
'
)
!==
-
1
)
{
url
=
`
${
url
}
/`
url
=
`
${
url
}
/`
}
else
if
(
url
.
indexOf
(
'
/remote
'
)
!==
-
1
)
{
//use of remote doctype
url
=
`
${
this
.
cozyUrl
}${
url
}
/`
}
else
{
}
else
{
url
=
url
=
document
.
location
.
protocol
===
'
https:
'
document
.
location
.
protocol
===
'
https:
'
...
@@ -58,7 +65,11 @@ export default class MatomoTracker {
...
@@ -58,7 +65,11 @@ export default class MatomoTracker {
window
.
_paq
=
window
.
_paq
||
[]
window
.
_paq
=
window
.
_paq
||
[]
MatomoTracker
.
push
([
'
enableHeartBeatTimer
'
,
30
])
MatomoTracker
.
push
([
'
enableHeartBeatTimer
'
,
30
])
MatomoTracker
.
push
([
'
setSiteId
'
,
this
.
siteId
])
MatomoTracker
.
push
([
'
setSiteId
'
,
this
.
siteId
])
MatomoTracker
.
push
([
'
setTrackerUrl
'
,
`
${
url
+
this
.
phpFilename
}
`
])
// MatomoTracker.push(['setTrackerUrl', `${url + this.phpFilename}`])
MatomoTracker
.
push
([
'
setTrackerUrl
'
,
`http://cozy.tools:8080/remote/org.ecolyo.matomo.rec`
,
])
MatomoTracker
.
push
([
'
enableLinkTracking
'
])
MatomoTracker
.
push
([
'
enableLinkTracking
'
])
}
}
return
{
return
{
...
...
This diff is collapsed.
Click to expand it.
Bastien DUMONT
@bdumont
mentioned in commit
54d29134
·
3 years ago
mentioned in commit
54d29134
mentioned in commit 54d29134d5ad6384bdbacb6a87f7e7051b5994f0
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment