Skip to content

Commit

Permalink
fix: redirect to specific nerdlets if returning user
Browse files Browse the repository at this point in the history
  • Loading branch information
abrunner committed Nov 30, 2021
1 parent a2e7e38 commit 08a5a35
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/experiments/super_tiles/components/CodeStreamTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ import { css } from '@emotion/react';
import SuperTile from './SuperTile';
import { Button, useTessen } from '@newrelic/gatsby-theme-newrelic';
import { Link } from 'gatsby';
import Cookies from 'js-cookie';
import { getPackNr1Url } from '../../../utils/get-pack-nr1-url';

const CodeStreamTile = () => {
const tessen = useTessen();

const link =
'/instant-observability/codestream/29bd9a4a-1c19-4219-9694-0942f6411ce7/';
const isReturningUser = Boolean(Cookies.get('ajs_user_id'));
const quickstartId = '29bd9a4a-1c19-4219-9694-0942f6411ce7';
const nerdletId = 'codestream-install.home';

const link = isReturningUser
? getPackNr1Url(quickstartId, nerdletId)
: '/instant-observability/codestream/29bd9a4a-1c19-4219-9694-0942f6411ce7/';

const handleButtonClick = () => {
tessen.track('clickSuperTile', 'QuickstartLanding', { tile: 'codestream' });
Expand Down
16 changes: 14 additions & 2 deletions src/experiments/super_tiles/components/GuidedInstallTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,25 @@ import {
} from '@newrelic/gatsby-theme-newrelic';
import { navigate } from 'gatsby';
import Cookies from 'js-cookie';
import { SIGNUP_LINK, LOGIN_LINK } from '../../../data/constants';
import {
SIGNUP_LINK,
NR1_GUIDED_INSTALL_NERDLET,
} from '../../../data/constants';
import { getGuidedInstallStackedNr1Url } from '../../../utils/get-pack-nr1-url';

const GuidedInstallTile = () => {
const isReturningUser = Boolean(Cookies.get('ajs_user_id'));

const handleNavigation = () => {
const platformUrl = isReturningUser
? getGuidedInstallStackedNr1Url(NR1_GUIDED_INSTALL_NERDLET)
: SIGNUP_LINK;

navigate(platformUrl);
};

const handleButtonClick = useInstrumentedHandler(
() => navigate(isReturningUser ? LOGIN_LINK : SIGNUP_LINK),
handleNavigation,
{
tessenEventName: 'clickSuperTile',
tessenCategoryName: 'QuickstartLanding',
Expand Down

0 comments on commit 08a5a35

Please sign in to comment.