File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 3737 "outbound" ,
3838 "emails" ,
3939 "downloads" ,
40+ "phones" ,
4041 ] ) ;
4142 var fullUrls = setting ( "fullUrls" , "bool" , false ) ;
4243
4546 outbound : collectTypes . indexOf ( "outbound" ) > - 1 ,
4647 emails : collectTypes . indexOf ( "emails" ) > - 1 ,
4748 downloads : collectTypes . indexOf ( "downloads" ) > - 1 ,
49+ phones : collectTypes . indexOf ( "phones" ) > - 1 ,
4850 // Downloads: enter file extensions you want to collect
4951 downloadsExtensions : setting ( "extensions" , "array" , [
5052 "pdf" ,
122124 metadata . email = event ;
123125 break ;
124126 }
127+ case "phone" : {
128+ var hrefPhone = element . getAttribute ( "href" ) ;
129+ event = ( hrefPhone . split ( ":" ) [ 1 ] || "" ) . split ( "?" ) [ 0 ] ;
130+ metadata . phone = event ;
131+ break ;
132+ }
125133 }
126134 }
127135
174182 // Collect email clicks
175183 } else if ( optionsLink . emails && / ^ m a i l t o : / i. test ( link . href ) ) {
176184 collect = "email" ;
185+
186+ // Collect telephone clicks
187+ } else if ( optionsLink . phones && / ^ t e l : / i. test ( link . href ) ) {
188+ collect = "phone" ;
177189 }
178190
179191 if ( ! collect ) return ;
208220 if ( ! href ) continue ;
209221
210222 // We don't want to overwrite website behaviour so we check for the onclick attribute
211- if ( ! link . getAttribute ( "onclick" ) && ! / ^ m a i l t o : / . test ( href ) ) {
223+ if (
224+ ! link . getAttribute ( "onclick" ) &&
225+ ! / ^ m a i l t o : / . test ( href ) &&
226+ ! / ^ t e l : / . test ( href )
227+ ) {
212228 collectLink ( link , true ) ;
213229 } else {
214230 collectLink ( link , false ) ;
You can’t perform that action at this time.
0 commit comments