From af9841342c3ef3a117a373b847a923703fff69d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20=C5=9Awi=C4=99cki?= Date: Fri, 17 Jan 2025 16:00:33 +0100 Subject: [PATCH 1/2] [SNOW-1887437] Pass query params to snowflake trial signup page link --- components/blocks/smartLink.js | 31 +++++++++++++++++++++++++ components/blocks/tile.js | 8 ++++++- content/get-started/installation/sis.md | 2 +- pages/[...slug].js | 2 ++ 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 components/blocks/smartLink.js diff --git a/components/blocks/smartLink.js b/components/blocks/smartLink.js new file mode 100644 index 000000000..58e688aa1 --- /dev/null +++ b/components/blocks/smartLink.js @@ -0,0 +1,31 @@ +import React from "react"; +import { useRouter } from "next/router"; + +const useQuery = () => { + const router = useRouter(); + return router.query; +}; + +const SmartLink = () => { + const query = useQuery(); + const utm_content = query.utm_content; + const baseUrl = "https://signup.snowflake.com/"; + const params = new URLSearchParams({ + utm_source: "streamlit", + utm_medium: "referral", + utm_campaign: "na-us-en-", + utm_content: utm_content || "-ss-streamlit-docs", + }); + const signupUrlWithUTMs = `${baseUrl}?${params.toString()}`; + return ( +
+ Go to{" "} + + signup.snowflake.com + + . (This link will open in a new tab.) +
+ ); +}; + +export default SmartLink; diff --git a/components/blocks/tile.js b/components/blocks/tile.js index 44984fa47..526a634cf 100644 --- a/components/blocks/tile.js +++ b/components/blocks/tile.js @@ -3,6 +3,7 @@ import classNames from "classnames"; import Link from "next/link"; import styles from "./tile.module.css"; +import { useRouter } from "next/router"; const Tile = ({ img, @@ -54,6 +55,7 @@ const Tile = ({ } const backgroundColor = BG_CLASS[background]; + const router = useRouter(); return (
- + + {/**/} {image}

{title || "Install Streamlit"}

diff --git a/content/get-started/installation/sis.md b/content/get-started/installation/sis.md index d28add367..21f53660c 100644 --- a/content/get-started/installation/sis.md +++ b/content/get-started/installation/sis.md @@ -19,7 +19,7 @@ All you need is an email address! Everything else happens in your 30-day trial a ## Create an account -1. Go to signup.snowflake.com. (This link will open in a new tab.) +1. 1. Fill in your information, and click "**CONTINUE**." diff --git a/pages/[...slug].js b/pages/[...slug].js index c24f10a84..d50f7943b 100644 --- a/pages/[...slug].js +++ b/pages/[...slug].js @@ -69,6 +69,7 @@ import Tip from "../components/blocks/tip"; import Warning from "../components/blocks/warning"; import YouTube from "../components/blocks/youTube"; import Cloud from "../components/blocks/cloud"; +import SmartLink from "../components/blocks/smartLink"; import styles from "../components/layouts/container.module.css"; @@ -147,6 +148,7 @@ export default function Article({ Image, Download, Flex, + SmartLink, Autofunction: (props) => ( Date: Wed, 22 Jan 2025 00:33:19 -0800 Subject: [PATCH 2/2] Rename component to SnowflakeTrial --- .../blocks/{smartLink.js => snowflakeTrial.js} | 15 ++++++--------- content/get-started/installation/sis.md | 2 +- pages/[...slug].js | 4 ++-- 3 files changed, 9 insertions(+), 12 deletions(-) rename components/blocks/{smartLink.js => snowflakeTrial.js} (70%) diff --git a/components/blocks/smartLink.js b/components/blocks/snowflakeTrial.js similarity index 70% rename from components/blocks/smartLink.js rename to components/blocks/snowflakeTrial.js index 58e688aa1..dac5c0df3 100644 --- a/components/blocks/smartLink.js +++ b/components/blocks/snowflakeTrial.js @@ -6,7 +6,7 @@ const useQuery = () => { return router.query; }; -const SmartLink = () => { +const SnowflakeTrial = ({ text }) => { const query = useQuery(); const utm_content = query.utm_content; const baseUrl = "https://signup.snowflake.com/"; @@ -17,15 +17,12 @@ const SmartLink = () => { utm_content: utm_content || "-ss-streamlit-docs", }); const signupUrlWithUTMs = `${baseUrl}?${params.toString()}`; + const linkText = text || "signup.snowflake.com"; return ( -
- Go to{" "} - - signup.snowflake.com - - . (This link will open in a new tab.) -
+ + {linkText} + ); }; -export default SmartLink; +export default SnowflakeTrial; diff --git a/content/get-started/installation/sis.md b/content/get-started/installation/sis.md index 21f53660c..f53d845c6 100644 --- a/content/get-started/installation/sis.md +++ b/content/get-started/installation/sis.md @@ -19,7 +19,7 @@ All you need is an email address! Everything else happens in your 30-day trial a ## Create an account -1. +1. Go to . (This link will open in a new tab.) 1. Fill in your information, and click "**CONTINUE**." diff --git a/pages/[...slug].js b/pages/[...slug].js index d50f7943b..a7c094685 100644 --- a/pages/[...slug].js +++ b/pages/[...slug].js @@ -69,7 +69,7 @@ import Tip from "../components/blocks/tip"; import Warning from "../components/blocks/warning"; import YouTube from "../components/blocks/youTube"; import Cloud from "../components/blocks/cloud"; -import SmartLink from "../components/blocks/smartLink"; +import SnowflakeTrial from "../components/blocks/snowflakeTrial"; import styles from "../components/layouts/container.module.css"; @@ -148,7 +148,7 @@ export default function Article({ Image, Download, Flex, - SmartLink, + SnowflakeTrial, Autofunction: (props) => (