Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SNOW-1887437] Pass query params to snowflake trial signup page link #1220

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions components/blocks/snowflakeTrial.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from "react";
import { useRouter } from "next/router";

const useQuery = () => {
const router = useRouter();
return router.query;
};

const SnowflakeTrial = ({ text }) => {
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()}`;
const linkText = text || "signup.snowflake.com";
return (
<a href={signupUrlWithUTMs} target="_blank">
{linkText}
</a>
);
};

export default SnowflakeTrial;
8 changes: 7 additions & 1 deletion components/blocks/tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -54,6 +55,7 @@ const Tile = ({
}

const backgroundColor = BG_CLASS[background];
const router = useRouter();

return (
<div
Expand All @@ -63,7 +65,11 @@ const Tile = ({
backgroundColor,
)}
>
<Link href={link || "/"} className={classNames("not-link", styles.Link)}>
<Link
href={{ pathname: link || "/", query: router.query }}
className={classNames("not-link", styles.Link)}
>
{/*<Link href={link || "/"} className={classNames("not-link", styles.Link)}>*/}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: remove

{image}
<div>
<h4 className={styles.Title}>{title || "Install Streamlit"}</h4>
Expand Down
2 changes: 1 addition & 1 deletion content/get-started/installation/sis.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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.)
1. Go to <SnowflakeTrial />. (This link will open in a new tab.)

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

Expand Down
2 changes: 2 additions & 0 deletions pages/[...slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -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 SnowflakeTrial from "../components/blocks/snowflakeTrial";

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

Expand Down Expand Up @@ -147,6 +148,7 @@ export default function Article({
Image,
Download,
Flex,
SnowflakeTrial,
Autofunction: (props) => (
<Autofunction
{...props}
Expand Down