Skip to content

Commit 1d60b76

Browse files
[SNOW-1887437] Pass query params to snowflake trial signup page link (#1220)
* [SNOW-1887437] Pass query params to snowflake trial signup page link * Rename component to SnowflakeTrial * [SNOW-1887437] Cleanup --------- Co-authored-by: Debbie Matthews <debbie.matthews@snowflake.com>
1 parent 3c29f44 commit 1d60b76

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import React from "react";
2+
import { useRouter } from "next/router";
3+
4+
const useQuery = () => {
5+
const router = useRouter();
6+
return router.query;
7+
};
8+
9+
const SnowflakeTrial = ({ text }) => {
10+
const query = useQuery();
11+
const utm_content = query.utm_content;
12+
const baseUrl = "https://signup.snowflake.com/";
13+
const params = new URLSearchParams({
14+
utm_source: "streamlit",
15+
utm_medium: "referral",
16+
utm_campaign: "na-us-en-",
17+
utm_content: utm_content || "-ss-streamlit-docs",
18+
});
19+
const signupUrlWithUTMs = `${baseUrl}?${params.toString()}`;
20+
const linkText = text || "signup.snowflake.com";
21+
return (
22+
<a href={signupUrlWithUTMs} target="_blank">
23+
{linkText}
24+
</a>
25+
);
26+
};
27+
28+
export default SnowflakeTrial;

components/blocks/tile.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import classNames from "classnames";
33
import Link from "next/link";
44

55
import styles from "./tile.module.css";
6+
import { useRouter } from "next/router";
67

78
const Tile = ({
89
img,
@@ -54,6 +55,7 @@ const Tile = ({
5455
}
5556

5657
const backgroundColor = BG_CLASS[background];
58+
const router = useRouter();
5759

5860
return (
5961
<div
@@ -63,7 +65,10 @@ const Tile = ({
6365
backgroundColor,
6466
)}
6567
>
66-
<Link href={link || "/"} className={classNames("not-link", styles.Link)}>
68+
<Link
69+
href={{ pathname: link || "/", query: router.query }}
70+
className={classNames("not-link", styles.Link)}
71+
>
6772
{image}
6873
<div>
6974
<h4 className={styles.Title}>{title || "Install Streamlit"}</h4>

content/get-started/installation/sis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ All you need is an email address! Everything else happens in your 30-day trial a
1919

2020
## Create an account
2121

22-
1. Go to <a href="https://signup.snowflake.com/?utm_source=streamlit&utm_medium=referral&utm_campaign=na-us-en-&utm_content=-ss-streamlit-docs" target="_blank">signup.snowflake.com</a>. (This link will open in a new tab.)
22+
1. Go to <SnowflakeTrial />. (This link will open in a new tab.)
2323

2424
1. Fill in your information, and click "**CONTINUE**."
2525

pages/[...slug].js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import Tip from "../components/blocks/tip";
6969
import Warning from "../components/blocks/warning";
7070
import YouTube from "../components/blocks/youTube";
7171
import Cloud from "../components/blocks/cloud";
72+
import SnowflakeTrial from "../components/blocks/snowflakeTrial";
7273

7374
import styles from "../components/layouts/container.module.css";
7475

@@ -147,6 +148,7 @@ export default function Article({
147148
Image,
148149
Download,
149150
Flex,
151+
SnowflakeTrial,
150152
Autofunction: (props) => (
151153
<Autofunction
152154
{...props}

0 commit comments

Comments
 (0)