File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change 225225 body : JSON . stringify ( {
226226 domain : siteDomain ,
227227 url : window . location . href ,
228+ referrer : document . referrer ,
228229 } ) ,
229- } ) . then ( async ( res ) => {
230- if ( ! res . ok ) {
231- const { error } = await res . json ( ) ;
232- console . error (
233- `[Dub Analytics] Failed to track visit: ${ error . message } ` ,
234- ) ;
235- return ;
236- }
237- const { clickId } = await res . json ( ) ; // Response: { clickId: string }
238- setCookie ( CLICK_ID , clickId , cookieOptions ) ;
239- } ) ;
230+ } )
231+ . then ( async ( res ) => {
232+ if ( ! res . ok ) {
233+ const { error } = await res . json ( ) ;
234+ console . error (
235+ `[Dub Analytics] Failed to track visit: ${ error . message } ` ,
236+ ) ;
237+ return ;
238+ }
239+ const { clickId } = await res . json ( ) ; // Response: { clickId: string }
240+ setCookie ( CLICK_ID , clickId , cookieOptions ) ;
241+ } )
242+ . catch ( ( error ) => {
243+ console . error ( '[Dub Analytics] Failed to track visit:' , error ) ;
244+ } ) ;
240245 }
241246 }
242247
You can’t perform that action at this time.
0 commit comments