Skip to content

Commit

Permalink
feat: add quickstart name and id to tessen events
Browse files Browse the repository at this point in the history
  • Loading branch information
rudouglas committed Oct 18, 2021
1 parent f1bc742 commit 28422b0
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 9 deletions.
16 changes: 15 additions & 1 deletion src/components/Tabs/BarItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ import {
} from '@newrelic/gatsby-theme-newrelic';
import useTabs from './useTabs';

const BarItem = ({ index, children, id, count, disabled }) => {
const BarItem = ({
index,
children,
id,
count,
disabled,
quickstartName,
quickstartId,
}) => {
const [currentTab, setCurrentTab] = useTabs();

const isSelected =
Expand All @@ -18,6 +26,8 @@ const BarItem = ({ index, children, id, count, disabled }) => {
actionName: 'packTabToggle',
packTabState: currentTab,
packTabCount: count,
quickstartName,
quickstartId,
},
{ enabled: Boolean(currentTab) }
);
Expand All @@ -31,6 +41,8 @@ const BarItem = ({ index, children, id, count, disabled }) => {
tessen.track('instantObservability', `QuickstartTabToggle`, {
QuickstartTabState: id,
QuickstartTabCount: count,
quickstartName,
quickstartId,
});
}}
css={css`
Expand Down Expand Up @@ -137,6 +149,8 @@ BarItem.propTypes = {
id: PropTypes.string.isRequired,
count: PropTypes.number,
disabled: PropTypes.bool,
quickstartName: PropTypes.string.isRequired,
quickstartId: PropTypes.string.isRequired,
};

export default BarItem;
18 changes: 15 additions & 3 deletions src/components/quickstarts/SupportSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ import {
QUICKSTART_SUPPORT_LEVELS,
} from '../../data/constants';

const SupportSection = ({ supportLevel }) => {
const SupportSection = ({ supportLevel, quickstartName, quickstartId }) => {
const tessen = useTessen();
const supportLink = (
<Link
to={SUPPORT_LINK}
key={QUICKSTART_SUPPORT_LEVELS.NEWRELIC}
onClick={() =>
tessen.track('instantObservability', 'QuickstartDetailsSupportClick')
tessen.track('instantObservability', 'QuickstartDetailsSupportClick', {
quickstartName,
quickstartId,
})
}
>
Visit our Support Center
Expand All @@ -27,7 +30,14 @@ const SupportSection = ({ supportLevel }) => {
to={COMMUNITY_LINK}
key={QUICKSTART_SUPPORT_LEVELS.NEWRELIC}
onClick={() =>
tessen.track('instantObservability', 'QuickstartDetailsCommunityClick')
tessen.track(
'instantObservability',
'QuickstartDetailsCommunityClick',
{
quickstartName,
quickstartId,
}
)
}
>
the Explorers Hub
Expand Down Expand Up @@ -81,6 +91,8 @@ const SupportSection = ({ supportLevel }) => {

SupportSection.propTypes = {
supportLevel: PropTypes.string.isRequired,
quickstartName: PropTypes.string.isRequired,
quickstartId: PropTypes.string.isRequired,
};

export default SupportSection;
37 changes: 32 additions & 5 deletions src/templates/QuickstartDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,27 @@ const QuickstartDetails = ({ data, location }) => {
}
`}
>
<Tabs.BarItem id="overview">Overview</Tabs.BarItem>
<Tabs.BarItem
id="overview"
quickstartName={quickstart.name}
quickstartId={quickstart.id}
>
Overview
</Tabs.BarItem>
<Tabs.BarItem
id="dashboards"
count={quickstart.dashboards?.length ?? 0}
quickstartName={quickstart.name}
quickstartId={quickstart.id}
>
Dashboards
</Tabs.BarItem>
<Tabs.BarItem id="alerts" count={quickstart.alerts?.length ?? 0}>
<Tabs.BarItem
id="alerts"
count={quickstart.alerts?.length ?? 0}
quickstartName={quickstart.name}
quickstartId={quickstart.id}
>
Alerts
</Tabs.BarItem>
<Tabs.BarItem
Expand All @@ -205,6 +218,8 @@ const QuickstartDetails = ({ data, location }) => {
(quickstart.instrumentation?.length ?? 0) +
(quickstart.documentation?.length ?? 0)
}
quickstartName={quickstart.name}
quickstartId={quickstart.id}
>
Data sources
</Tabs.BarItem>
Expand Down Expand Up @@ -266,7 +281,11 @@ const QuickstartDetails = ({ data, location }) => {
onClick={() =>
tessen.track(
'instantObservability',
'QuickstartDetailsSignUpClick'
'QuickstartDetailsSignUpClick',
{
quickstartName: quickstart.name,
quickstartId: quickstart.id,
}
)
}
>
Expand All @@ -278,7 +297,11 @@ const QuickstartDetails = ({ data, location }) => {
onClick={() =>
tessen.track(
'instantObservability',
'QuickstartDetailsLoginClick'
'QuickstartDetailsLoginClick',
{
quickstartName: quickstart.name,
quickstartId: quickstart.id,
}
)
}
>
Expand All @@ -300,7 +323,11 @@ const QuickstartDetails = ({ data, location }) => {
</PageTools.Section>
<PageTools.Section>
<PageTools.Title>Support</PageTools.Title>
<SupportSection supportLevel={quickstart.level} />
<SupportSection
supportLevel={quickstart.level}
quickstartName={quickstart.name}
quickstartId={quickstart.id}
/>
</PageTools.Section>
</Layout.PageTools>
</PageLayout>
Expand Down

0 comments on commit 28422b0

Please sign in to comment.