Skip to content

Commit

Permalink
[WL-3329] Add home link v3 (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lariveg authored Jan 31, 2024
1 parent d62bda4 commit f5ab989
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/boot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export default (element: HTMLDivElement, hub: Hub) => {

const utmSource = element.getAttribute("data-utm-source") || undefined;
const utmCampaign = element.getAttribute("data-utm-campaign") || undefined;
const impactTrackingLink =
element.getAttribute("data-impact-tracking-link") || undefined;

if (element.getAttribute("data-encoded")) {
const exercise = JSON.parse(atob(decodeURIComponent(element.textContent)));
Expand Down Expand Up @@ -113,6 +115,7 @@ export default (element: HTMLDivElement, hub: Hub) => {
language={settings.language}
utmSource={utmSource}
utmCampaign={utmCampaign}
impactTrackingLink={impactTrackingLink}
/>
</Provider>
</AppContainer>
Expand Down
2 changes: 2 additions & 0 deletions src/components/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export interface IAppProps extends React.Props<App> {
nPlots?: number;
utmSource?: string;
utmCampaign?: string;
impactTrackingLink?: string;
}

interface IAppState {
Expand Down Expand Up @@ -321,6 +322,7 @@ export class App extends React.Component<IAppProps, IAppState> {
showSolutionButton={this.state.solutionButtonVisible}
utmSource={this.props.utmSource}
utmCampaign={this.props.utmCampaign}
impactTrackingLink={this.props.impactTrackingLink}
/>
</div>
</Provider>
Expand Down
11 changes: 8 additions & 3 deletions src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface IFooterProps extends React.Props<Footer> {
language?: string;
utmSource?: string;
utmCampaign?: string;
impactTrackingLink?: string;
}

interface IFooterState {
Expand Down Expand Up @@ -76,10 +77,14 @@ export class Footer extends React.PureComponent<IFooterProps, IFooterState> {
}

public render() {
const { utmSource, utmCampaign } = this.props;
const baseUrl = "https://www.datacamp.com/";
const { utmSource, utmCampaign, impactTrackingLink } = this.props;
const baseUrl = impactTrackingLink
? "https://datacamp.pxf.io"
: "https://www.datacamp.com/";
const queryParams = `utm_source=${utmSource}&utm_campaign=${utmCampaign}`;
const datacampUrl = `${baseUrl}?${queryParams}`;
const datacampUrl = impactTrackingLink
? `${baseUrl}${impactTrackingLink}`
: `${baseUrl}?${queryParams}`;

return (
<div className={styles.footer}>
Expand Down

0 comments on commit f5ab989

Please sign in to comment.