File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,18 @@ import { getProductCountByCategory } from "../../db/product"
3
3
import { getDoneAPIUploadCount , getDoneFileUploadCount } from "../../db/upload"
4
4
5
5
const getVisits = async ( ) => {
6
+ const params = new URLSearchParams ( )
7
+ params . append ( "token_auth" , process . env . MATOMO_API_TOKEN as string )
6
8
return axios
7
- . post <
8
- [ { nb_visits : number } ]
9
- > ( `${ process . env . NEXT_PUBLIC_MATOMO_SITE_URL } ?idSite=${ process . env . NEXT_PUBLIC_MATOMO_SITE_ID } &method=VisitsSummary.get&format=JSON&module=API&period=year&date=today&showColumns=nb_visits&filter_limit=-1&flat=1` )
9
+ . post < [ { nb_visits : number } ] > (
10
+ `${ process . env . NEXT_PUBLIC_MATOMO_SITE_URL } ?idSite=${ process . env . NEXT_PUBLIC_MATOMO_SITE_ID } &method=VisitsSummary.get&format=JSON&module=API&period=year&date=today&showColumns=nb_visits&filter_limit=-1&flat=1` ,
11
+ params ,
12
+ {
13
+ headers : {
14
+ "Content-Type" : "application/x-www-form-urlencoded" ,
15
+ } ,
16
+ } ,
17
+ )
10
18
. then ( ( response ) => response . data )
11
19
}
12
20
You can’t perform that action at this time.
0 commit comments