Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update webpack configure and support js file integrate #15

Merged
merged 4 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
zhu-xiaowei marked this conversation as resolved.
Show resolved Hide resolved
<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
Loading