Skip to content

Commit

Permalink
feat: added click through view instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rudouglas committed Jun 11, 2021
1 parent 1ce0b0f commit acc7245
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/pages/observability-packs.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,27 @@ const ObservabilityPacksPage = ({ data, location }) => {
setQuerySort,
setQuerySearch,
]);
useEffect(() => {
const handleClickThrough = () => {
tessen.track('observabilityPack', `ObservabilityPackClickThroughView`, {
oPackClickThroughView: view,
});
if (typeof window !== 'undefined' && window.newrelic) {
window.newrelic.addPageAction('oPackClickThroughView', {
oPackClickThroughView: view,
});
}
};
document.querySelectorAll('.pack-tile-instrument').forEach((item) => {
item.addEventListener('click', handleClickThrough);
});
// cleanup this component
return () => {
document.querySelectorAll('.pack-tile-instrument').forEach((item) => {
item.removeEventListener('click', handleClickThrough);
});
};
});
return (
<>
<DevSiteSeo title="Observability Packs" location={location} />
Expand Down Expand Up @@ -251,6 +272,7 @@ const ObservabilityPacksPage = ({ data, location }) => {
pack.logo ||
'https://via.placeholder.com/400x275.png?text=Image'
}
className="pack-tile-instrument"
to={`${pack.fields.slug}`}
/>
);
Expand All @@ -271,6 +293,7 @@ const ObservabilityPacksPage = ({ data, location }) => {
pack.logo ||
'https://via.placeholder.com/400x275.png?text=Image'
}
className="pack-tile-instrument"
to={`${pack.fields.slug}`}
/>
);
Expand Down

0 comments on commit acc7245

Please sign in to comment.