Skip to content

Commit aadaa74

Browse files
committed
docs(core): add core docs
1 parent 4507697 commit aadaa74

1 file changed

Lines changed: 58 additions & 58 deletions

File tree

packages/core/index.md

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -26,64 +26,6 @@ pnpm add @web-analytics/core
2626

2727
:::
2828

29-
## Usage
30-
31-
It is recommended to initialize in public tool files such as utils and export the initialized instance.
32-
33-
:::code-group
34-
35-
```ts [Baidu Analytics]
36-
// @/libs/analytics.ts
37-
import { createBaiduAnalytics } from '@web-analytics/core'
38-
39-
// Create and export the instance of baidu analytics platform
40-
export const baiduAnalytics = createBaiduAnalytics({
41-
websiteId: 'your_website_id',
42-
debug: true,
43-
})
44-
```
45-
46-
```ts [CNZZ Analytics]
47-
// @/libs/analytics.ts
48-
import { createCnzzAnalytics } from '@web-analytics/core'
49-
50-
// Create and export the instance of cnzz analytics platform
51-
export const cnzzAnalytics = createCnzzAnalytics({
52-
websiteId: 'your_website_id',
53-
debug: true,
54-
})
55-
```
56-
57-
:::
58-
59-
In other files, import the instance and call the method on the instance.
60-
61-
:::code-group
62-
63-
```ts [Baidu Analytics]
64-
// @/foo.ts
65-
import { baiduAnalytics } from '@/libs/analytics'
66-
67-
// For more methods, please see the documentation below
68-
baiduAnalytics.trackPageview({
69-
// Some options...
70-
})
71-
```
72-
73-
```ts [CNZZ Analytics]
74-
// @/foo.ts
75-
import { cnzzAnalytics } from '@/libs/analytics'
76-
77-
// For more methods, please see the documentation below
78-
cnzzAnalytics.trackPageview({
79-
// Some options...
80-
})
81-
```
82-
83-
:::
84-
85-
For more detailed instructions, continue reading the documentation.
86-
8729
## Platforms
8830

8931
The following analytics platforms are currently supported.
@@ -115,6 +57,8 @@ Because the developer of the plugin lives in mainland China, so the current prio
11557

11658
The plugin provides a method for creating an instance for each platform, and only needs to pass in the necessary options to complete the initialization work.
11759

60+
### Type Declarations
61+
11862
- Type Declaration of methods:
11963

12064
:::code-group
@@ -156,6 +100,62 @@ interface CreateAnalyticsInstanceOptions {
156100

157101
The JS-SDK file of the analytics platform will be loaded during initialization.
158102

103+
### Usage
104+
105+
It is recommended to initialize in public tool files such as utils and export the initialized instance.
106+
107+
:::code-group
108+
109+
```ts [Baidu Analytics]
110+
// @/libs/analytics.ts
111+
import { createBaiduAnalytics } from '@web-analytics/core'
112+
113+
// Create and export the instance of baidu analytics platform
114+
export const baiduAnalytics = createBaiduAnalytics({
115+
websiteId: 'your_website_id',
116+
debug: true,
117+
})
118+
```
119+
120+
```ts [CNZZ Analytics]
121+
// @/libs/analytics.ts
122+
import { createCnzzAnalytics } from '@web-analytics/core'
123+
124+
// Create and export the instance of cnzz analytics platform
125+
export const cnzzAnalytics = createCnzzAnalytics({
126+
websiteId: 'your_website_id',
127+
debug: true,
128+
})
129+
```
130+
131+
:::
132+
133+
In other files, import the instance and call the method on the instance.
134+
135+
:::code-group
136+
137+
```ts [Baidu Analytics]
138+
// @/foo.ts
139+
import { baiduAnalytics } from '@/libs/analytics'
140+
141+
// For more methods, please see the documentation below
142+
baiduAnalytics.trackPageview({
143+
// Some options...
144+
})
145+
```
146+
147+
```ts [CNZZ Analytics]
148+
// @/foo.ts
149+
import { cnzzAnalytics } from '@/libs/analytics'
150+
151+
// For more methods, please see the documentation below
152+
cnzzAnalytics.trackPageview({
153+
// Some options...
154+
})
155+
```
156+
157+
:::
158+
159159
## Methods
160160

161161
On the initialized instance, some APIs are provided to call.

0 commit comments

Comments
 (0)