# UTM Attribution (Algolia domains)

This NPM package aims to unify our capture and storage strategy towards UTMs (Urchin Tracking Module) on all Algolia domains/sub-domains (Website, Blog, Dashboard, Docs, etc.).

## Cookie consent

`algolia_website_utm_params` should be classified as a **Strictly Necessary cookie (`C0001`)**. The package captures the landing URL or referrer and writes the cookie on load, regardless of OneTrust availability or optional category consent.

Configure this cookie as Strictly Necessary in OneTrust separately. Consumer sites must upgrade to a release containing this change to get the new behavior.

If a site loads the browser build with a `<script>` tag, load it normally and remove the previous `type="text/plain"` and `optanon-category-C0004` attributes:

```html
<script src="https://cdn.jsdelivr.net/npm/@algolia/utm-attribution/dist/browser/index.min.js"></script>
```

## How to contribute

1. Clone this repository:

```bash
git clone git@github.com:algolia/utm-attribution.git
```

2. Create a branch, update the code, and make a commit and a PR to `develop` following [SEMVER](https://semver.org/) versioning convention.

## Releases

Once you consider that the `develop` branch holds enough changes to release a new version, here are the **5** steps to follow:

1. make sure you're releasing the correct version:

   - Breaking change, bump the **first** number (1.2.3 -> 2.0.0) - **Major**
   - New feature, bump the **second** number (1.2.3 -> 1.3.0) - **Minor**
   - Bug fixing, bump the **third** number (1.2.3 -> 1.2.4) - **Patch**
   - Unsure? Check [SEMVER](https://semver.org/)

2. run `npm version [your_version]`. This will **automatically**:

   - checkout `develop`
   - create a branch named with the version number
   - update the version number
   - push it to GitHub

3. have a look at the auto-generated CHANGELOG.md. Update some information manually if needed, commit and push it

4. create two PRs:

   - one to merge `[your_version]` into `develop` (this will update the `package.json` version)
   - the other one to merge `[your_version]` into `main`.

5. run `npm run publish` or `yarn publish` to push the new release to npm.
