Skip to content

Commit

Permalink
add sample rate
Browse files Browse the repository at this point in the history
  • Loading branch information
vgoodric committed Jan 14, 2025
1 parent 746f58e commit b15bc54
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion libs/features/personalization/personalization.js
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,11 @@ async function handleMartechTargetInteraction(
performance.clearMarks();
performance.clearMeasures();
try {
window.lana.log(`target response time: ${roundedResponseTime}`, { tags: 'martech', errorType: 'i' });
window.lana.log(`target response time: ${roundedResponseTime}`, {
tags: 'martech',
errorType: 'i',
sampleRate: 0.5,
});
} catch (e) {
// eslint-disable-next-line no-console
console.error('Error logging target response time:', e);
Expand Down
12 changes: 10 additions & 2 deletions libs/martech/martech.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ export const getTargetPersonalization = async (
window.addEventListener(ALLOY_SEND_EVENT, () => {
const responseTime = calculateResponseTime(responseStart);
try {
window.lana.log(`target response time: ${responseTime}`, { tags: 'martech', errorType: 'i' });
window.lana.log(`target response time: ${responseTime}`, {
tags: 'martech',
errorType: 'i',
sampleRate: 0.5,
});
} catch (e) {
// eslint-disable-next-line no-console
console.error('Error logging target response time:', e);
Expand All @@ -82,7 +86,11 @@ export const getTargetPersonalization = async (
const response = await waitForEventOrTimeout(ALLOY_SEND_EVENT, timeout);
if (response.error) {
try {
window.lana.log('target response time: ad blocker', { tags: 'martech', errorType: 'i' });
window.lana.log('target response time: ad blocker', {
tags: 'martech',
errorType: 'i',
sampleRate: 0.5,
});
} catch (e) {
// eslint-disable-next-line no-console
console.error('Error logging target response time for ad blocker:', e);
Expand Down

0 comments on commit b15bc54

Please sign in to comment.