fathomanalytics
Fathom Analytics is a simple, privacy-focused website analytics tool.
Usage
import { fathomanalytics } from 'netzo/apis/fathomanalytics.ts'
const api = fathomanalytics({
apiKey: Deno.env.get('FATHOMANALYTICS_API_KEY')
})
Configuration
The fathomanalytics
factory function expects an object with the following, and returns an object with an API client api
.
Param | Type | Default | Description |
---|---|---|---|
apiKey | string | Deno.env.get('FATHOMANALYTICS_API_KEY') | the api key to use for authentication |
Refer to the API documentation to get the required information.
Examples
The following examples assume you have created an api client instance.
Find sites
Find all sites the API key owns.
const query: QuerySites = {}
const result = await api.sites.get<Sites>(query)
const resultData = result.resultData
Get site
Get a site by id.
const resultData = await api.sites[SITE_ID].get<Site>()
Add site
Add a new site
const data: DataAddSite = { name: 'New website' }
const resultData = await api.sites.post<Site>(data)
Update site
Update a site by id
const data: DataUpdateSite = { name: 'Updated website' }
const resultData = await api.sites[SITE_ID].post<Site>(data)
Wipe site
Wipe all pageviews & event completions from a website to reset statistics.
const resultData = await api.sites[SITE_ID].data.delete<Site>()