Skip to content

Commit

Permalink
fix: no lcp target text from missing element (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekremney authored Apr 22, 2024
1 parent 1a18bc8 commit 0b75e80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function addCWVTracking() {
if (measurement.name === 'LCP' && measurement.entries.length > 0) {
const { element } = measurement.entries.pop();
data.target = targetselector(element);
data.source = sourceselector(element) || element.outerHTML.slice(0, 30);
data.source = sourceselector(element) || (element && element.outerHTML.slice(0, 30));
}
sampleRUM('cwv', data);
};
Expand Down

0 comments on commit 0b75e80

Please sign in to comment.