Skip to content

Commit

Permalink
fix: Add codeblock contents to tessen tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
LizBaker committed Dec 19, 2023
1 parent 2a8c271 commit 1561836
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/gatsby-theme-newrelic/src/components/CodeBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,14 @@ const CodeBlock = ({
code: formattedCode,
modified: false,
});
const copiedCode = containsEmbeddedHTML ? normalizedCode : code;

const handleCopyClick = useInstrumentedHandler(
() => copy(containsEmbeddedHTML ? normalizedCode : code),
{
eventName: 'copyCodeBlockClick',
category: 'CodeBlock',
modified,
}
);
const handleCopyClick = useInstrumentedHandler(() => copy(copiedCode), {
eventName: 'copyCodeBlockClick',
category: 'CodeBlock',
modified,
contents: copiedCode.replace(/[\r\n]+/gm, '').substring(0, 200),
});

const handleDownloadClick = useInstrumentedHandler(
() => {
Expand Down

0 comments on commit 1561836

Please sign in to comment.