Skip to content

Commit d0f09ec

Browse files
authored
UTM updates (#830)
1 parent ab6074b commit d0f09ec

File tree

5 files changed

+46
-17
lines changed

5 files changed

+46
-17
lines changed

backend/app/Resources/Account/AccountResource.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class AccountResource extends JsonResource
1414
public function toArray(Request $request): array
1515
{
1616
$activeStripePlatform = $this->getPrimaryStripePlatform();
17+
$isHiEvents = config('app.is_hi_events', false);
1718

1819
return [
1920
'id' => $this->getId(),
@@ -31,6 +32,9 @@ public function toArray(Request $request): array
3132
'stripe_account_details' => $activeStripePlatform->getStripeAccountDetails(),
3233
'stripe_platform' => $this->getActiveStripePlatform()?->value,
3334
]),
35+
$this->mergeWhen($isHiEvents, fn() => [
36+
'stripe_hi_events_primary_platform' => config('services.stripe.primary_platform')
37+
]),
3438

3539
$this->mergeWhen($this->getConfiguration() !== null, fn() => [
3640
'configuration' => new AccountConfigurationResource($this->getConfiguration()),

frontend/src/components/common/PoweredByFooter/index.tsx

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import {t} from "@lingui/macro";
22
import classes from "./FloatingPoweredBy.module.scss";
33
import classNames from "classnames";
4-
import React from "react";
4+
import React, {useMemo} from "react";
55
import {iHavePurchasedALicence, isHiEvents} from "../../../utilites/helpers.ts";
6+
import {getConfig} from "../../../utilites/config.ts";
67

78
/**
89
* (c) Hi.Events Ltd 2025
@@ -17,29 +18,54 @@ import {iHavePurchasedALicence, isHiEvents} from "../../../utilites/helpers.ts";
1718
*
1819
* If you wish to remove this notice, a commercial license is available at: https://hi.events/licensing
1920
*/
20-
export const PoweredByFooter = (props: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>) => {
21+
export const PoweredByFooter = (
22+
props: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
23+
) => {
2124
if (iHavePurchasedALicence()) {
2225
return <></>;
2326
}
2427

28+
const link = useMemo(() => {
29+
let host = getConfig("VITE_FRONTEND_URL") ?? "unknown";
30+
let medium = "app";
31+
32+
if (typeof window !== "undefined" && window.location) {
33+
host = window.location.hostname;
34+
medium = window.location.pathname.includes("/widget") ? "widget" : "app";
35+
}
36+
37+
const url = new URL("https://hi.events");
38+
url.searchParams.set("utm_source", "app-powered-by-footer");
39+
url.searchParams.set("utm_medium", isHiEvents() ? medium : 'self-hosted-' + medium);
40+
url.searchParams.set("utm_campaign", "powered-by");
41+
url.searchParams.set("utm_content", isHiEvents() ? "hi.events" : host);
42+
43+
return url.toString();
44+
}, []);
45+
2546
const footerContent = isHiEvents() ? (
2647
<>
27-
{t`Planning an event?`} {' '}
28-
<a href="https://hi.events?utm_source=app-powered-by-footer&utm_content=try-hi-events-free"
29-
target="_blank"
30-
className={classes.ctaLink}
31-
title={'Effortlessly manage events and sell tickets online with Hi.Events'}>
48+
{t`Planning an event?`}{" "}
49+
<a
50+
href={`${link}`}
51+
target="_blank"
52+
className={classes.ctaLink}
53+
title={"Effortlessly manage events and sell tickets online with Hi.Events"}
54+
>
3255
{t`Try Hi.Events Free`}
3356
</a>
3457
</>
3558
) : (
3659
<>
37-
{t`Powered by`} {' '}
38-
<a href="https://hi.events?utm_source=app-powered-by-footer"
39-
target="_blank"
40-
title={'Effortlessly manage events and sell tickets online with Hi.Events'}>
60+
{t`Powered by`}{" "}
61+
<a
62+
href={link}
63+
target="_blank"
64+
title={"Effortlessly manage events and sell tickets online with Hi.Events"}
65+
>
4166
Hi.Events
42-
</a> 🚀
67+
</a>{" "}
68+
🚀
4369
</>
4470
);
4571

frontend/src/components/routes/account/ManageAccount/sections/PaymentSettings/index.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ const MigrationBanner = ({stripeData}: { stripeData: StripeConnectAccountsRespon
105105
<IconInfoCircle size={20}/>
106106
</ThemeIcon>
107107
<div>
108-
<Title order={3}>{t`Ready to Upgrade?`}</Title>
109-
<Text size="sm" c="dimmed">{t`Complete the setup below to continue`}</Text>
108+
<Title order={3}>{t`Complete the setup below to continue`}</Title>
110109
</div>
111110
</Group>
112111

@@ -370,7 +369,6 @@ const HiEventsConnectStatus = ({account}: { account: Account }) => {
370369
const hasIrelandAccount = !!ieAccount;
371370
const isIrelandComplete = ieAccount?.is_setup_complete === true;
372371

373-
// Build the appropriate UI based on clear conditions
374372
let content;
375373

376374
if (isIrelandComplete) {
@@ -442,7 +440,7 @@ const HiEventsConnectStatus = ({account}: { account: Account }) => {
442440
variant="light"
443441
size="sm"
444442
leftSection={<IconBrandStripe size={20}/>}
445-
onClick={() => handleSetupStripe('ie')}
443+
onClick={() => handleSetupStripe((account?.stripe_hi_events_primary_platform || 'ie') as 'ca' | 'ie')}
446444
>
447445
{t`Connect with Stripe`}
448446
</Button>

frontend/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export interface Account {
9999
configuration?: AccountConfiguration;
100100
requires_manual_verification?: boolean;
101101
stripe_platform: string;
102+
stripe_hi_events_primary_platform?: string;
102103
}
103104

104105
export interface AccountConfiguration {

frontend/src/utilites/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export const iHavePurchasedALicence = () => {
111111
}
112112

113113
export const isHiEvents = () => {
114-
return true;
114+
return getConfig('VITE_FRONTEND_URL')?.includes('.hi.events');
115115
}
116116

117117
export const isEmptyHtml = (content: string) => {

0 commit comments

Comments
 (0)