File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 100100 } ) ;
101101 }
102102
103+ const shouldSetCookie = ( ) => {
104+ return (
105+ ! cookieManager . get ( DUB_ID_VAR ) || ATTRIBUTION_MODEL !== 'first-click'
106+ ) ;
107+ } ;
108+
109+ // Track clicks for dynamic pages (Eg: example.com/profile/[username])
110+ // WIP
111+ function captureClick ( identifier ) {
112+ if ( shouldSetCookie ( ) ) {
113+ trackClick ( identifier ) ;
114+ }
115+ }
116+
103117 // Initialize tracking
104118 function init ( ) {
105119 const params = new URLSearchParams ( location . search ) ;
106120
107- const shouldSetCookie = ( ) => {
108- return (
109- ! cookieManager . get ( DUB_ID_VAR ) || ATTRIBUTION_MODEL !== 'first-click'
110- ) ;
111- } ;
112-
113121 // Direct click ID in URL
114122 const clickId = params . get ( DUB_ID_VAR ) ;
115123 if ( clickId && shouldSetCookie ( ) ) {
139147 n : DOMAINS_CONFIG , // was DOMAINS_CONFIG
140148 } ;
141149
150+ window . dubAnalytics = {
151+ trackClick : captureClick ,
152+ } ;
153+
142154 // Initialize
143155 init ( ) ;
144156} ) ( ) ;
Original file line number Diff line number Diff line change 11import { TrackClickInput } from './types' ;
22
33export const trackClick = ( event : TrackClickInput ) => {
4- console . log ( 'Track click ' , event ) ;
4+ console . log ( 'trackClick ' , event ) ;
55} ;
You can’t perform that action at this time.
0 commit comments