Skip to content

Commit ece0a68

Browse files
committed
searchParam → queryParam
1 parent d31874e commit ece0a68

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

packages/script/src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@
3838
const api = script.getAttribute('data-api');
3939
const am = script.getAttribute('data-attribution-model');
4040
const co = script.getAttribute('data-cookie-options');
41-
const sp = script.getAttribute('data-search-param');
41+
const qp = script.getAttribute('data-query-param');
4242

4343
return {
4444
api: api || 'https://api.dub.co/track/click',
4545
attributionModel: am || 'last-click',
4646
cookieOptions: co ? JSON.parse(co) : null,
47-
searchParam: sp || 'ref',
47+
queryParam: qp || 'ref',
4848
};
4949
}
5050

@@ -100,13 +100,13 @@
100100
// Function to check for { keys } in the URL and update cookie if necessary
101101
function watchForQueryParams() {
102102
const searchParams = new URLSearchParams(window.location.search);
103-
const { api, cookieOptions, attributionModel, searchParam } =
103+
const { api, cookieOptions, attributionModel, queryParam } =
104104
getOptions(script);
105105

106106
let clickId = searchParams.get(CLICK_ID) || searchParams.get(OLD_CLICK_ID);
107107

108108
if (!clickId) {
109-
const identifier = searchParams.get(searchParam);
109+
const identifier = searchParams.get(queryParam);
110110

111111
if (identifier) {
112112
fetch(api, {

packages/web/src/generic.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ function inject(props: AnalyticsProps): void {
3333
);
3434
}
3535

36-
if (props.searchParam) {
37-
script.setAttribute('data-search-param', props.searchParam);
36+
if (props.queryParam) {
37+
script.setAttribute('data-query-param', props.queryParam);
3838
}
3939

4040
if (props.scriptProps) {

packages/web/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ export interface AnalyticsProps {
108108
};
109109

110110
/**
111-
* The search parameter to listen to for client-side click-tracking (e.g. `?ref=abc123`)
111+
* The query parameter to listen to for client-side click-tracking (e.g. `?ref=abc123`)
112112
*
113113
* @default 'ref'
114114
*/
115-
searchParam?: string;
115+
queryParam?: string;
116116

117117
/**
118118
* Custom properties to pass to the script.

0 commit comments

Comments
 (0)