import { createInstance } from '@jonkoops/matomo-tracker-react'
import { InstanceParams } from '@jonkoops/matomo-tracker-react/lib/types'

import { PAGES } from 'config/pages'

const getMatomoInstance = () => {
  let matomoInstance: InstanceParams = {
    siteId: 999,
    urlBase: 'link.to.domain',
  }

  switch (process.env.REACT_APP_CLIENT) {
    case 'insports':
      matomoInstance = {
        ...matomoInstance,
        siteId: 1,
        urlBase: PAGES.matomoInstatBaseUrl,
      }
      break
  }

  return createInstance(matomoInstance)
}

export const matomoInstance = getMatomoInstance()
