Skip to content

Commit 3b01919

Browse files
zhu-xiaoweixiaoweii
andauthored
feat: support packaged as directly imported js file
Co-authored-by: xiaoweii <xiaoweii@amazom.com>
1 parent 821918c commit 3b01919

File tree

6 files changed

+520
-24
lines changed

6 files changed

+520
-24
lines changed

README.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,20 +163,41 @@ ClickstreamAnalytics.updateConfigure({
163163

164164
## How to integrate and test locally
165165

166-
**Integrate**
166+
### Integrate the `.tgz` file
167167

168-
Clone this repository locally, execute the following script to generate `aws-clickstream-web-x.x.x.tgz` zip package, which will be located in the project root folder.
168+
Clone this repository locally and execute the following script to generate `aws-clickstream-web-0.2.0.tgz` zip package, which will be located in the project root folder.
169169
```bash
170-
cd clickstream-web && npm run pack
170+
cd clickstream-web && npm i && npm run pack
171171
```
172172

173-
Copy the `aws-clickstream-web-x.x.x.tgz` into your project, then execute the following script in your project root folder to install the SDK.
173+
Copy the `aws-clickstream-web-0.2.0.tgz` into your project, then execute the script in your project root folder to install the SDK.
174174
```bash
175-
npm install ./aws-clickstream-web-x.x.x.tgz
175+
npm install ./aws-clickstream-web-0.2.0.tgz
176176
```
177-
Note: Please correct the SDK version and change the path to where the `aws-clickstream-web-x.x.x.tgz` file is located.
177+
**Note**: Please correct the SDK version and change the path to where the `aws-clickstream-web-0.2.0.tgz` file is located.
178178

179-
**Test**
179+
### Integrate the `clickstream-web.min.js` file
180+
Execute the following script to generate `clickstream-web.min.js`, located in the `/dist` folder.
181+
```bash
182+
cd clickstream-web && npm i && npm run pack
183+
```
184+
Copy the `clickstream-web.min.js` into your project and add the following initial code into your `index.html`.
185+
186+
```html
187+
<script src="clickstream-web.min.js"></script>
188+
<script>
189+
window.ClickstreamAnalytics.init({
190+
appId: 'your appId',
191+
endpoint: 'https://example.com/collect',
192+
isLogEvents: true,
193+
pageType: window.PageType.SPA, //multiPageApp
194+
sendMode: window.SendMode.Batch, //Immediate
195+
})
196+
</script>
197+
```
198+
You can also find the `clickstream-web.min.js` file in the [Release](https://github.com/awslabs/clickstream-web/releases) page.
199+
200+
### Test
180201

181202
```bash
182203
npm run test

0 commit comments

Comments
 (0)