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(analytics): implement tracking using WebSDK #22

Merged
merged 22 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d01100e
feat(analytics): add alloy v2.17.0
iuliag Jul 26, 2023
244f445
feat(analytics): add page views and link clicks analytics tracking ba…
iuliag Jul 26, 2023
38b06e8
chore: linting
iuliag Jul 27, 2023
b9c8aff
feat: forward Franklin RUM CWV measurements to AEP using WebSDK/alloy
iuliag Aug 8, 2023
1011872
feat: forward Franklin RUM 404 and error events to AEP using WebSDK/a…
iuliag Aug 8, 2023
de78294
feat: integration with CMP, fallback to localstorage flag if set
iuliag Aug 8, 2023
4a2b368
chore: review
iuliag Aug 9, 2023
6300cf1
Merge commit 'ae0bbbc60e43898ab526a43944e846bea344adac' as 'plugins/r…
iuliag Aug 17, 2023
ae0bbbc
Squashed 'plugins/rum-conversion/' content from commit fc90b08
iuliag Aug 17, 2023
da15599
feat: add RUM conversion tracking
iuliag Aug 17, 2023
1a555b5
feat: forward Franklin RUM conversion events to AEP using WebSDK/alloy
iuliag Aug 17, 2023
885210b
feat: cache for 0.1s the form conversion events, so we can send merge…
iuliag Aug 17, 2023
bc1e10b
Squashed 'plugins/rum-conversion/' changes from fc90b08..9dd77bb
iuliag Aug 21, 2023
057f7d3
chore: update RUM conversion
iuliag Aug 21, 2023
a817be5
Use form submit event instead of submit button onclick (#24)
chicharr Aug 22, 2023
4fca751
fix: track form id from form dataset action if element id not set
iuliag Aug 22, 2023
c237ed4
feat: track form submissions
iuliag Aug 22, 2023
b4104de
Merge commit 'c48311787670b015155fd5cc8fd79437bf5dc399' into websdk
iuliag Aug 22, 2023
c483117
Squashed 'plugins/rum-conversion/' changes from 9dd77bb..c146fce
iuliag Aug 22, 2023
aad4bea
fix: link URL
iuliag Aug 23, 2023
03627b6
Squashed 'plugins/rum-conversion/' changes from c146fce..fba407f
iuliag Aug 25, 2023
7a60932
Merge commit '03627b6624d3b17f2a224f403a3e5e08fbfe301e' into websdk
iuliag Aug 25, 2023
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
5 changes: 4 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
helix-importer-ui
ued.js
ued.js
/scripts/analytics/alloy*.js
/styles/**/*.min.css
/scripts/**/*.min.js
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
coverage/*
logs/*
node_modules/*
.idea

helix-importer-ui
4 changes: 2 additions & 2 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<meta property="og:title" content="Page not found">
<script src="/scripts/scripts.js" type="module" crossorigin="use-credentials"></script>
<script type="module">
import { sampleRUM } from '/scripts/scripts.js';
import { sampleRUM } from '/scripts/lib-franklin.js';

window.addEventListener('load', () => {
if (document.referrer) {
Expand Down Expand Up @@ -64,4 +64,4 @@ <h2 class="error-message">Page Not Found</h2>
<footer></footer>
</body>

</html>
</html>
12 changes: 7 additions & 5 deletions blocks/form/form.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { analyticsTrackFormSubmission } from '../../scripts/analytics/lib-analytics.js';

function createSelect(fd) {
const select = document.createElement('select');
select.id = fd.Field;
Expand Down Expand Up @@ -46,17 +48,17 @@ async function submitForm(form) {
return payload;
}

function createButton(fd) {
function createButton(fd, form = '') {
const button = document.createElement('button');
button.textContent = fd.Label;
button.classList.add('button');
if (fd.Type === 'submit') {
button.addEventListener('click', async (event) => {
const form = button.closest('form');
if (fd.Type === 'submit' && form) {
form.addEventListener('submit', async (event) => {
if (form.checkValidity()) {
event.preventDefault();
button.setAttribute('disabled', '');
await submitForm(form);
await analyticsTrackFormSubmission(form);
const redirectTo = fd.Extra;
window.location.href = redirectTo;
}
Expand Down Expand Up @@ -150,7 +152,7 @@ async function createForm(formURL) {
fieldWrapper.append(createTextArea(fd));
break;
case 'submit':
fieldWrapper.append(createButton(fd));
fieldWrapper.append(createButton(fd, form));
break;
default:
fieldWrapper.append(createLabel(fd));
Expand Down
1 change: 1 addition & 0 deletions blocks/recent-articles/recent-articles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* stylelint-disable */
1 change: 1 addition & 0 deletions blocks/recent-trips/recent-trips.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* stylelint-disable */
1 change: 1 addition & 0 deletions plugins/rum-conversion/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
helix-importer-ui
21 changes: 21 additions & 0 deletions plugins/rum-conversion/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
extends: 'airbnb-base',
env: {
browser: true,
},
parser: '@babel/eslint-parser',
parserOptions: {
allowImportExportEverywhere: true,
sourceType: 'module',
requireConfigFile: false,
},
rules: {
// allow reassigning param
'no-param-reassign': [2, { props: false }],
'linebreak-style': ['error', 'unix'],
'import/extensions': ['error', {
js: 'always',
}],
},
};
12 changes: 12 additions & 0 deletions plugins/rum-conversion/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
coverage
.nyc_output/
node_modules/
junit
dist
tmp
logs
.DS_Store
test-results.xml
.env
.idea
.npmrc
20 changes: 20 additions & 0 deletions plugins/rum-conversion/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
*.tgz
.circleci/
.eslintignore
.eslintrc.js
.github/
.idea
.jsdoc.json
.nyc_output/
.releaserc.js
.renovaterc.json
.snyk
.tidelift.yml
build
coverage
junit
logs
node_modules/
snykmocha.js
test
test-results.xml
8 changes: 8 additions & 0 deletions plugins/rum-conversion/.stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": [
"stylelint-config-standard"
],
"rules": {
"declaration-block-no-redundant-longhand-properties": null
}
}
13 changes: 13 additions & 0 deletions plugins/rum-conversion/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2022 Adobe. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Loading
Loading