Skip to content

Commit

Permalink
feat: add install button and instrument
Browse files Browse the repository at this point in the history
  • Loading branch information
rudouglas committed Jun 11, 2021
1 parent da42517 commit 2cd7e5d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/InstallButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ const InstallButton = ({ title, ...props }) => {
};

InstallButton.propTypes = {
title: PropTypes.string,
guid: PropTypes.string,
title: PropTypes.string.isRequired,
guid: PropTypes.string.isRequired,
};

export default InstallButton;
24 changes: 19 additions & 5 deletions src/templates/ObservabilityPackDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import DevSiteSeo from '../components/DevSiteSeo';
import PropTypes from 'prop-types';
import PageLayout from '../components/PageLayout';
import Tabs from '../components/Tabs';
import { Layout, PageTools, Button } from '@newrelic/gatsby-theme-newrelic';
import { Layout, PageTools, useTessen } from '@newrelic/gatsby-theme-newrelic';
import ImageGallery from '../components/ImageGallery';
import Intro from '../components/Intro';
import InstallButton from '../components/InstallButton';

const ObservabilityPackDetails = ({ data, location }) => {
const pack = data.observabilityPacks;

const tessen = useTessen();
return (
<>
<DevSiteSeo title={pack.name} location={location} />
Expand All @@ -24,9 +25,22 @@ const ObservabilityPackDetails = ({ data, location }) => {
gap: 1rem;
`}
>
<Button variant={Button.VARIANT.PRIMARY} size={Button.SIZE.MEDIUM}>
Install
</Button>
<InstallButton
title="Install"
guid={pack.id}
onClick={() => {
tessen.track('observabilityPack', `ObservabilityPackInstall`, {
installPackName: pack.name,
installPackId: pack.id,
});
if (typeof window !== 'undefined' && window.newrelic) {
window.newrelic.addPageAction('oPackInstall', {
installPackName: pack.name,
installPackId: pack.id,
});
}
}}
/>
<Tabs.Bar
css={css`
margin-top: 1rem;
Expand Down

0 comments on commit 2cd7e5d

Please sign in to comment.