mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-16 16:04:34 +00:00
Bing ad (#5195)
* Bing Ad * Add msclkid parameter to login provider and registration API
This commit is contained in:
1
packages/global/support/marketing/type.d.ts
vendored
1
packages/global/support/marketing/type.d.ts
vendored
@@ -7,6 +7,7 @@ export type ShortUrlParams = {
|
||||
export type TrackRegisterParams = {
|
||||
inviterId?: string;
|
||||
bd_vid?: string;
|
||||
msclkid?: string;
|
||||
fastgpt_sem?: {
|
||||
keyword?: string;
|
||||
} & ShortUrlParams;
|
||||
|
@@ -16,6 +16,7 @@ import {
|
||||
getBdVId,
|
||||
getFastGPTSem,
|
||||
getInviterId,
|
||||
getMsclkid,
|
||||
getSourceDomain,
|
||||
removeFastGPTSem
|
||||
} from '@/web/support/marketing/utils';
|
||||
@@ -60,6 +61,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
|
||||
password,
|
||||
inviterId: getInviterId(),
|
||||
bd_vid: getBdVId(),
|
||||
msclkid: getMsclkid(),
|
||||
fastgpt_sem: getFastGPTSem(),
|
||||
sourceDomain: getSourceDomain()
|
||||
})
|
||||
|
@@ -15,6 +15,7 @@ import {
|
||||
getBdVId,
|
||||
getFastGPTSem,
|
||||
getInviterId,
|
||||
getMsclkid,
|
||||
getSourceDomain,
|
||||
removeFastGPTSem
|
||||
} from '@/web/support/marketing/utils';
|
||||
@@ -49,6 +50,7 @@ const provider = () => {
|
||||
callbackUrl: `${location.origin}/login/provider`,
|
||||
inviterId: getInviterId(),
|
||||
bd_vid: getBdVId(),
|
||||
msclkid: getMsclkid(),
|
||||
fastgpt_sem: getFastGPTSem(),
|
||||
sourceDomain: getSourceDomain()
|
||||
});
|
||||
|
@@ -11,6 +11,7 @@ import {
|
||||
setBdVId,
|
||||
setFastGPTSem,
|
||||
setInviterId,
|
||||
setMsclkid,
|
||||
setSourceDomain,
|
||||
setUtmParams,
|
||||
setUtmWorkflow
|
||||
@@ -20,6 +21,7 @@ import { type ShortUrlParams } from '@fastgpt/global/support/marketing/type';
|
||||
type MarketingQueryParams = {
|
||||
hiId?: string;
|
||||
bd_vid?: string;
|
||||
msclkid?: string;
|
||||
k?: string;
|
||||
sourceDomain?: string;
|
||||
utm_source?: string;
|
||||
@@ -31,6 +33,7 @@ type MarketingQueryParams = {
|
||||
const MARKETING_PARAMS: (keyof MarketingQueryParams)[] = [
|
||||
'hiId',
|
||||
'bd_vid',
|
||||
'msclkid',
|
||||
'k',
|
||||
'sourceDomain',
|
||||
'utm_source',
|
||||
@@ -41,8 +44,17 @@ const MARKETING_PARAMS: (keyof MarketingQueryParams)[] = [
|
||||
|
||||
export const useInitApp = () => {
|
||||
const router = useRouter();
|
||||
const { hiId, bd_vid, k, sourceDomain, utm_source, utm_medium, utm_content, utm_workflow } =
|
||||
router.query as MarketingQueryParams;
|
||||
const {
|
||||
hiId,
|
||||
bd_vid,
|
||||
msclkid,
|
||||
k,
|
||||
sourceDomain,
|
||||
utm_source,
|
||||
utm_medium,
|
||||
utm_content,
|
||||
utm_workflow
|
||||
} = router.query as MarketingQueryParams;
|
||||
|
||||
const { loadGitStar, setInitd, feConfigs } = useSystemStore();
|
||||
const { userInfo } = useUserStore();
|
||||
@@ -121,6 +133,7 @@ export const useInitApp = () => {
|
||||
useMount(() => {
|
||||
setInviterId(hiId);
|
||||
setBdVId(bd_vid);
|
||||
setMsclkid(msclkid);
|
||||
setUtmWorkflow(utm_workflow);
|
||||
setSourceDomain(sourceDomain);
|
||||
|
||||
|
@@ -22,6 +22,14 @@ export const setBdVId = (bdVid?: string) => {
|
||||
sessionStorage.setItem('bd_vid', bdVid);
|
||||
};
|
||||
|
||||
export const getMsclkid = () => {
|
||||
return sessionStorage.getItem('msclkid') || undefined;
|
||||
};
|
||||
export const setMsclkid = (msclkid?: string) => {
|
||||
if (!msclkid) return;
|
||||
sessionStorage.setItem('msclkid', msclkid);
|
||||
};
|
||||
|
||||
export const getUtmWorkflow = () => {
|
||||
return localStorage.getItem('utm_workflow') || undefined;
|
||||
};
|
||||
|
@@ -37,6 +37,7 @@ export const postRegister = ({
|
||||
code,
|
||||
inviterId,
|
||||
bd_vid,
|
||||
msclkid,
|
||||
fastgpt_sem
|
||||
}: AccountRegisterBody) =>
|
||||
POST<ResLogin>(`/proApi/support/user/account/register/emailAndPhone`, {
|
||||
@@ -44,6 +45,7 @@ export const postRegister = ({
|
||||
code,
|
||||
inviterId,
|
||||
bd_vid,
|
||||
msclkid,
|
||||
fastgpt_sem,
|
||||
password: hashStr(password)
|
||||
});
|
||||
|
Reference in New Issue
Block a user