File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 6464 hypothesisLoaded = true ;
6565
6666 var sidePanelOpened = false ;
67+ // window.DEFAULT_URL should be the wb link in this format:
68+ // https://<wb-domain>/v1/resources/<preprint-guid>/providers/osfstorage/<file-id>?direct=&mode=render
69+ // TODO: parse and validate the WB URL before retrieving the preprints GUID
70+ var wbLink = window . DEFAULT_URL ;
71+ var preprintGuid ;
72+ if ( wbLink . split ( '/' ) . length >= 6 ) {
73+ preprintGuid = wbLink . split ( '/' ) [ 5 ] ;
74+ } else {
75+ preprintGuid = 'preprint-guid-unknown' ;
76+ }
6777 var sendAnalyticsIfExpanded = function ( expanded ) {
6878 if ( expanded && ! sidePanelOpened ) {
6979 sidePanelOpened = expanded ;
7080 ga ( 'send' , 'event' , {
7181 eventCategory : 'Hypothesis' ,
7282 eventAction : 'Open Hypothesis Panel' ,
73- eventLabel : window . DEFAULT_URL . split ( '/' ) [ 5 ] ,
83+ //`eventLabel` is the guid of the preprint to which the file belongs
84+ eventLabel : preprintGuid ,
7485 } ) ;
7586 }
7687 } ;
You can’t perform that action at this time.
0 commit comments