Skip to content

Commit

Permalink
Add UTM parameters to IDX links (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis authored Nov 29, 2024
1 parent 3fb12c3 commit d253659
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pages/[...rest].ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ function idxProjectName(example: ExampleData, repo: string) {
*/
function idxUrl(example: ExampleData, repo: string, ref = 'latest') {
const url = new URL('https://idx.google.com/new');
// Add UTM parameters for IDX to track.
url.searchParams.set('utm_source', 'astro');
url.searchParams.set('utm_medium', 'astro');
url.searchParams.set('utm_campaign', 'astro');
// Select the Astro template to use when starting up IDX.
url.searchParams.set('astroTemplate', toTemplateName({ ...example, repo }));
// Pre-fill the IDX wizard with a project name based on the selected template.
Expand Down

0 comments on commit d253659

Please sign in to comment.