Skip to content
Merged
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
5 changes: 4 additions & 1 deletion website/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { trackAttrs } from "@/lib/analytics";
import { AppIcon } from "@/components/AppIcon";
import { CONTACT_EMAIL, FACEBOOK_URL, ISSUES_URL, REPO_URL, SITE_NAME, TRADEMARK_LINE } from "@/lib/site";
import { CONTACT_EMAIL, FACEBOOK_URL, ISSUES_URL, REPO_URL, SITE_NAME, SOUNDCHECKPLAYER_URL, TRADEMARK_LINE } from "@/lib/site";

export function Footer() {
return (
Expand Down Expand Up @@ -54,6 +54,9 @@ export function Footer() {
<li>
<a href={FACEBOOK_URL}>Facebook</a>
</li>
<li>
<a href={SOUNDCHECKPLAYER_URL}>SoundcheckPlayer</a>
</li>
</ul>
</nav>
<nav aria-label="Supported mixers">
Expand Down
3 changes: 3 additions & 0 deletions website/lib/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export const REPO_URL = "https://github.com/ericdahl-dev/ShowRecorder";
export const ISSUES_URL = `${REPO_URL}/issues`;
// The ShowRecorder Facebook Page. It has no username yet (Facebook won't allow one on this Page so far), so the address is its id.
export const FACEBOOK_URL = "https://www.facebook.com/profile.php?id=61596288844683";
// The sister site: SoundcheckPlayer plays a Take back into the mixer. Tagged like every link we write, so PostHog
// (Owned Sites, $host soundcheckplayer.app) shows the visits this site sent. One campaign per placement.
export const SOUNDCHECKPLAYER_URL = "https://soundcheckplayer.app/?utm_source=showrecorder&utm_campaign=footer";

// Pro's price. It is set in lib/price.ts (lib/docs.ts needs it, and this file imports lib/docs.ts) and read from here.
export { PRO_PRICE, PRO_PRICE_TEXT } from "@/lib/price";
Expand Down
44 changes: 44 additions & 0 deletions website/tests/soundcheckPlayerLink.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { readdirSync, readFileSync, statSync } from "node:fs";
import path from "node:path";
import { renderToStaticMarkup } from "react-dom/server";
import { createElement } from "react";
import { Footer } from "@/components/Footer";
import { SOUNDCHECKPLAYER_URL } from "@/lib/site";

// soundcheckplayer.app is the sister site: SoundcheckPlayer plays a ShowRecorder Take back into the mixer. It links
// here three times; this site links back from the footer, so search engines and visitors can find it. Like every
// link we write, it is tagged, so PostHog (Owned Sites) shows the visits this site sent.

const ROOT = path.resolve(__dirname, "..");

function sources(dir: string): string[] {
return readdirSync(dir).flatMap((name) => {
const file = path.join(dir, name);
if (statSync(file).isDirectory()) return sources(file);
return /\.(tsx?|mdx)$/.test(name) ? [file] : [];
});
}

describe("the link to soundcheckplayer.app", () => {
it("carries the showrecorder source and the footer campaign, and ends cleanly", () => {
expect(SOUNDCHECKPLAYER_URL).toBe("https://soundcheckplayer.app/?utm_source=showrecorder&utm_campaign=footer");
});

it("is in the footer on every page, under the app's name", () => {
const html = renderToStaticMarkup(createElement(Footer));
expect(html).toContain(`<a href="${SOUNDCHECKPLAYER_URL.replace(/&/g, "&amp;")}">SoundcheckPlayer</a>`);
});

it("is never written as a bare, untagged address anywhere on the site", () => {
for (const file of ["app", "components", "lib"].flatMap((d) => sources(path.join(ROOT, d)))) {
for (const [url] of readFileSync(file, "utf8").matchAll(/https:\/\/soundcheckplayer\.app[^\s"'`)<]*/g)) {
expect(url, file).toMatch(/\?utm_source=showrecorder&utm_campaign=[a-z0-9-]+$/);
}
}
});

it("never calls the app Virtual Soundcheck", () => {
const html = renderToStaticMarkup(createElement(Footer));
expect(html).not.toMatch(/Virtual Soundcheck/);
});
});
Loading