Skip to content

Commit

Permalink
feat: support packaged as directly imported js file
Browse files Browse the repository at this point in the history
Co-authored-by: xiaoweii <xiaoweii@amazom.com>
  • Loading branch information
zhu-xiaowei and xiaoweii authored Aug 31, 2023
1 parent 821918c commit 3b01919
Show file tree
Hide file tree
Showing 6 changed files with 520 additions and 24 deletions.
35 changes: 28 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,41 @@ ClickstreamAnalytics.updateConfigure({

## How to integrate and test locally

**Integrate**
### Integrate the `.tgz` file

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.
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.
```bash
cd clickstream-web && npm run pack
cd clickstream-web && npm i && npm run pack
```

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.
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.
```bash
npm install ./aws-clickstream-web-x.x.x.tgz
npm install ./aws-clickstream-web-0.2.0.tgz
```
Note: Please correct the SDK version and change the path to where the `aws-clickstream-web-x.x.x.tgz` file is located.
**Note**: Please correct the SDK version and change the path to where the `aws-clickstream-web-0.2.0.tgz` file is located.

**Test**
### Integrate the `clickstream-web.min.js` file
Execute the following script to generate `clickstream-web.min.js`, located in the `/dist` folder.
```bash
cd clickstream-web && npm i && npm run pack
```
Copy the `clickstream-web.min.js` into your project and add the following initial code into your `index.html`.

```html
<script src="clickstream-web.min.js"></script>
<script>
window.ClickstreamAnalytics.init({
appId: 'your appId',
endpoint: 'https://example.com/collect',
isLogEvents: true,
pageType: window.PageType.SPA, //multiPageApp
sendMode: window.SendMode.Batch, //Immediate
})
</script>
```
You can also find the `clickstream-web.min.js` file in the [Release](https://github.com/awslabs/clickstream-web/releases) page.

### Test

```bash
npm run test
Expand Down
Loading

0 comments on commit 3b01919

Please sign in to comment.