Skip to content

Commit

Permalink
Squashed 'plugins/rum-conversion/' changes from 9dd77bb..c146fce
Browse files Browse the repository at this point in the history
c146fce feat(omnivore): Add conversion tracking data attribute to tracked elements (#7)
c70885a Update README.md (#5)

git-subtree-dir: plugins/rum-conversion
git-subtree-split: c146fce535b26a9a88925cfeaa742da8f5dcf55f
  • Loading branch information
iuliag committed Aug 22, 2023
1 parent bc1e10b commit c483117
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,32 @@ Adds conversion tracking functionality to Helix RUM Collection (client-side)

## Installation

###### SSH

```bash
git subtree add --squash --prefix plugins/rum-conversion [email protected]:adobe/franklin-rum-conversion.git main
```

###### HTTPS

```bash
git subtree add --squash --prefix plugins/rum-conversion https://github.com/adobe/franklin-rum-conversion.git main
```

You can then later update it from the source again via:

###### SSH

```bash
git subtree pull --squash --prefix plugins/rum-conversion [email protected]:adobe/franklin-rum-conversion.git main
```

###### HTTPS

```bash
git subtree pull --squash --prefix plugins/rum-conversion https://github.com/adobe/franklin-rum-conversion.git main
```

:warning: If you are using a folder as a franklin docroot/codeBasePath: you must add that folder in the `prefix` argument in the commands above.
e.g.:
```
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ sampleRUM.drain('convert', (cevent, cvalueThunk, element, listenTo = []) => {
if (Array.isArray(elements) || elements instanceof NodeList) {
elements.forEach((e) => registerConversionListener(e, listenTo, cevent, cvalueThunk));
} else {
// add data attribute to elements tracked in preview
if (window.location.hostname === 'localhost' || window.location.hostname.endsWith('.hlx.page')) {
element.dataset.conversionTracking = true;
}
listenTo.forEach((eventName) => element.addEventListener(
eventName,
(e) => trackConversion(e.target),
Expand Down

0 comments on commit c483117

Please sign in to comment.