File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 8787
8888 let clientClickTracked = false ;
8989 // Track click and set cookie
90- function trackClick ( identifier ) {
90+ function trackClick ( identifier , serverClickId ) {
9191 if ( clientClickTracked ) return ;
9292 clientClickTracked = true ;
9393
104104 . then ( ( res ) => res . ok && res . json ( ) )
105105 . then ( ( data ) => {
106106 if ( data ) {
107+ if ( serverClickId && serverClickId !== data . clickId ) {
108+ console . warn (
109+ `Client-tracked click ID ${ data . clickId } does not match server-tracked click ID ${ queryParamClickId } , skipping...` ,
110+ ) ;
111+ return ;
112+ }
107113 cookieManager . set ( DUB_ID_VAR , data . clickId ) ;
108114 // if partner data is present, set it as dub_partner_data cookie
109115 if ( data . partner ) {
143149
144150 // Dub Partners tracking (via query param e.g. ?via=partner_id)
145151 if ( QUERY_PARAM_VALUE && SHORT_DOMAIN && shouldSetCookie ( ) ) {
146- trackClick ( QUERY_PARAM_VALUE ) ;
152+ trackClick ( QUERY_PARAM_VALUE , clickId ) ;
147153 }
148154 }
149155
You can’t perform that action at this time.
0 commit comments