File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 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
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 , {
Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments