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: adding viewmedia and viewblock scroll depth #758

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions tools/oversight/elements/list-facet.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,16 @@ export default class ListFacet extends HTMLElement {
engagementLI.classList.add('conversion');
ul.append(engagementLI);

const viewblockDepthLI = this.createBusinessMetricChiclet(entry, 'blockdepth', null, 25, 60, 80);
viewblockDepthLI.title = 'Block Depth';
viewblockDepthLI.classList.add('conversion');
ul.append(viewblockDepthLI);

const viewMediaDepthLI = this.createBusinessMetricChiclet(entry, 'mediadepth', null, 25, 60, 80);
viewMediaDepthLI.title = 'Media Depth';
viewMediaDepthLI.classList.add('conversion');
ul.append(viewMediaDepthLI);

const conversionRateLI = this.createBusinessMetricChiclet(entry, 'conversions', 'visits', 5, 10, 20);
conversionRateLI.title = 'Conversion Rate';
conversionRateLI.classList.add('conversion');
Expand Down Expand Up @@ -468,6 +478,10 @@ export default class ListFacet extends HTMLElement {
total: this.dataChunks.totals[baseline].count,
conversions: this.dataChunks.totals[rate].count,
});
} else if (rate === 'blockdepth' || rate === 'mediadepth') {
const value = (entry.metrics[rate].percentile(50) / entry.metrics[rate].max) * 100;
nf.textContent = value;
meter.value = Number.isFinite(value) ? value : 0;
} else {
// we show the median and use a t-test between all values
const value = entry.metrics[rate].percentile(50);
Expand Down
9 changes: 8 additions & 1 deletion tools/oversight/rum-slicer.css
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,6 @@ facet-sidebar:has(input[name="focus"][value="conversion"]) aside ul.cwv li.conve

facet-sidebar:has(input[name="focus"][value="conversion"]:checked) aside ul.cwv li.conversion {
display: flex;
grid-column: span 3;
}

ul.cwv meter {
Expand Down Expand Up @@ -657,6 +656,14 @@ fieldset div:first-of-type li:nth-of-type(7)::before {
}

fieldset div:first-of-type li:nth-of-type(8)::before {
content: 'Blockdepth';
}

fieldset div:first-of-type li:nth-of-type(9)::before {
content: 'Mediadepth';
}

fieldset div:first-of-type li:nth-of-type(10)::before {
content: 'Conversion';
}

Expand Down
11 changes: 11 additions & 0 deletions tools/oversight/slicer.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ loader.apiEndpoint = API_ENDPOINT;

const herochart = new window.slicer.Chart(dataChunks, elems);

const eventCountFn = (type) => (bundle) => {
const eventCount = bundle.events.filter(
(e) => e.checkpoint === type,
).length;
return eventCount;
};

window.addEventListener('pageshow', () => !elems.canvas && herochart.render());

// set up metrics for dataChunks
Expand All @@ -59,6 +66,10 @@ dataChunks.addSeries('conversions', (bundle) => (dataChunks.hasConversion(bundle
: 0));

dataChunks.addSeries('organic', organic);

dataChunks.addSeries('blockdepth', eventCountFn('viewblock'));
dataChunks.addSeries('mediadepth', eventCountFn('viewmedia'));

/*
* timeOnPage is the time it took to load the page,
* i.e. the difference between the first and last event
Expand Down
Loading