Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
camino
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
pub
pnm-public
camino
Commits
ad9203de
Unverified
Commit
ad9203de
authored
3 years ago
by
vmaubert
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(matomo): corrige la configuration de Matomo (#24)
parent
b19d518c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docker-compose.local.yml
+3
-0
3 additions, 0 deletions
docker-compose.local.yml
packages/ui/src/index.ts
+33
-32
33 additions, 32 deletions
packages/ui/src/index.ts
packages/ui/src/stats/bootstrap.js
+2
-6
2 additions, 6 deletions
packages/ui/src/stats/bootstrap.js
with
38 additions
and
38 deletions
docker-compose.local.yml
+
3
−
0
View file @
ad9203de
...
@@ -43,12 +43,15 @@ services:
...
@@ -43,12 +43,15 @@ services:
build
:
build
:
context
:
.
context
:
.
dockerfile
:
Dockerfile.ui
dockerfile
:
Dockerfile.ui
args
:
GIT_SHA
:
unused
environment
:
environment
:
UI_PORT
:
${UI_PORT}
UI_PORT
:
${UI_PORT}
API_URL
:
${API_URL}
API_URL
:
${API_URL}
API_MATOMO_URL
:
${API_MATOMO_URL}
API_MATOMO_URL
:
${API_MATOMO_URL}
API_MATOMO_ID
:
${API_MATOMO_ID}
API_MATOMO_ID
:
${API_MATOMO_ID}
ENV
:
${ENV}
ENV
:
${ENV}
APPLICATION_VERSION
:
unused
ports
:
ports
:
-
${UI_PORT}:${UI_PORT}
-
${UI_PORT}:${UI_PORT}
This diff is collapsed.
Click to expand it.
packages/ui/src/index.ts
+
33
−
32
View file @
ad9203de
...
@@ -17,13 +17,13 @@ import store from './store'
...
@@ -17,13 +17,13 @@ import store from './store'
window
.
ResizeObserver
=
window
.
ResizeObserver
||
resizeObserverPolyfill
window
.
ResizeObserver
=
window
.
ResizeObserver
||
resizeObserverPolyfill
const
app
=
createApp
(
App
)
Promise
.
resolve
().
then
(
async
()
=>
{
sync
(
store
,
router
)
const
app
=
createApp
(
App
)
sync
(
store
,
router
)
if
(
import
.
meta
.
env
.
PROD
)
{
if
(
import
.
meta
.
env
.
PROD
)
{
fetch
(
'
/sentryOptions
'
)
try
{
.
then
(
response
=>
response
.
json
()
)
const
sentryResponse
=
await
fetch
(
'
/sentryOptions
'
)
.
then
(
options
=
>
{
const
options
=
await
sentryResponse
.
json
()
if
(
!
options
.
dsn
)
throw
new
Error
(
'
dsn manquant
'
)
if
(
!
options
.
dsn
)
throw
new
Error
(
'
dsn manquant
'
)
Sentry
.
init
({
Sentry
.
init
({
dsn
:
options
.
dsn
,
dsn
:
options
.
dsn
,
...
@@ -40,17 +40,18 @@ if (import.meta.env.PROD) {
...
@@ -40,17 +40,18 @@ if (import.meta.env.PROD) {
// @ts-ignore
// @ts-ignore
release
:
`camino-ui-
${
applicationVersion
}
`
release
:
`camino-ui-
${
applicationVersion
}
`
})
})
}
)
}
catch
(
e
)
{
.
catch
(
e
=>
console
.
error
(
'
erreur : Sentry :
'
,
e
)
)
console
.
error
(
'
erreur : Sentry :
'
,
e
)
}
const
matomo
=
fetch
(
'
/matomoOptions
'
)
try
{
.
then
(
response
=
>
response
.
json
()
)
const
response
=
await
fetch
(
'
/matomoOptions
'
)
.
then
(
options
=
>
{
const
options
=
await
response
.
json
()
if
(
!
options
||
!
options
.
host
||
!
options
.
siteId
)
if
(
!
options
||
!
options
.
host
||
!
options
.
siteId
)
throw
new
Error
(
'
host et/ou siteId manquant(s)
'
)
throw
new
Error
(
'
host et/ou siteId manquant(s)
'
)
return
VueMatomo
({
host
:
'
https://stats.data.gouv.fr
'
,
const
matomo
=
await
VueMatomo
({
siteId
:
70
,
host
:
options
.
host
,
siteId
:
options
.
siteId
,
router
,
router
,
store
,
store
,
requireConsent
:
false
,
requireConsent
:
false
,
...
@@ -60,22 +61,22 @@ if (import.meta.env.PROD) {
...
@@ -60,22 +61,22 @@ if (import.meta.env.PROD) {
enableHeartBeatTimer
:
true
,
enableHeartBeatTimer
:
true
,
enableLinkTracking
:
true
enableLinkTracking
:
true
})
})
})
app
.
provide
(
'
matomo
'
,
matomo
)
.
catch
(
e
=>
console
.
error
(
'
erreur : matomo :
'
,
e
))
app
.
config
.
globalProperties
.
$matomo
=
matomo
app
.
provide
(
'
matomo
'
,
matomo
)
}
catch
(
e
)
{
app
.
config
.
globalProperties
.
$matomo
=
matomo
console
.
error
(
'
erreur : matomo :
'
,
e
)
const
eventSource
=
new
EventSource
(
'
/stream/version
'
)
eventSource
.
addEventListener
(
'
version
'
,
event
=>
{
if
(
event
.
data
!==
applicationVersion
)
{
eventSource
.
close
()
window
.
location
.
reload
()
}
}
})
}
app
.
use
(
router
)
const
eventSource
=
new
EventSource
(
'
/stream/version
'
)
app
.
use
(
store
)
eventSource
.
addEventListener
(
'
version
'
,
event
=>
{
if
(
event
.
data
!==
applicationVersion
)
{
app
.
mount
(
'
app-root
'
)
eventSource
.
close
()
window
.
location
.
reload
()
}
})
}
app
.
use
(
router
)
app
.
use
(
store
)
app
.
mount
(
'
app-root
'
)
})
This diff is collapsed.
Click to expand it.
packages/ui/src/stats/bootstrap.js
+
2
−
6
View file @
ad9203de
...
@@ -2,7 +2,7 @@ export default function (options) {
...
@@ -2,7 +2,7 @@ export default function (options) {
const
{
host
,
trackerFileName
}
=
options
const
{
host
,
trackerFileName
}
=
options
const
filename
=
`
${
host
}
/
${
trackerFileName
}
.js`
const
filename
=
`
${
host
}
/
${
trackerFileName
}
.js`
const
scriptPromise
=
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
script
=
document
.
createElement
(
'
script
'
)
const
script
=
document
.
createElement
(
'
script
'
)
script
.
async
=
true
script
.
async
=
true
script
.
defer
=
true
script
.
defer
=
true
...
@@ -13,13 +13,9 @@ export default function (options) {
...
@@ -13,13 +13,9 @@ export default function (options) {
script
.
onload
=
resolve
script
.
onload
=
resolve
script
.
onerror
=
reject
script
.
onerror
=
reject
})
}).
catch
(
error
=>
{
scriptPromise
.
catch
(
error
=>
{
console
.
info
(
console
.
info
(
`Warning:
${
error
.
target
.
src
}
. If the file exists, you may have a tracking blocker enabled.`
`Warning:
${
error
.
target
.
src
}
. If the file exists, you may have a tracking blocker enabled.`
)
)
})
})
return
scriptPromise
}
}
This diff is collapsed.
Click to expand it.
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