-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathencore-stats.js
executable file
·50 lines (45 loc) · 2.33 KB
/
encore-stats.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
dojo.addOnLoad(function(){
dojo.query('div#articlesPreviewAnyComponent').connect('onclick', function(evt){
if(evt.target.id.indexOf("URLLinkComponent") != -1){
_gaq.push(['_trackEvent', "Discovery", "Articles access click", "Read article"]);
}
else if(evt.target.id.indexOf("recordDisplayLink2Component") != -1){
_gaq.push(['_trackEvent', "Discovery", "Articles access click", "Read article"]);
}
else if(evt.target.id.indexOf("fedSearchResultsLinkComponent") != -1){
_gaq.push(['_trackEvent', "Discovery", "View more articles click", "Articles channel focus"]);
}
});
dojo.query('span.content-Articles').connect('onclick', function(evt){ // articles at top of discovery
_gaq.push(['_trackEvent', "Discovery", "Articles channel click", "Articles channel focus"]);
});
dojo.query('span.content-Catalog').connect('onclick', function(evt){ // catalog at top of synergy
_gaq.push(['_trackEvent', "Synergy", "Catalog channels click", "Catalog channel focus"]);
});
dojo.query('div#facetsSearchPageArea').connect('onclick', function(evt){
if(evt.target.id.indexOf("federatedResultsLinkComponent") != -1){
_gaq.push(['_trackEvent', "Discovery", "Articles facet click", "Articles channel focus"]); // articles from facets
}
});
dojo.query('span#pageContentUpdateAreaAnyComponent').connect('onclick', function(evt){
if(evt.target.id.indexOf("URLLinkComponent") != -1){
_gaq.push(['_trackEvent', "Synergy", "Articles access click", "Read article"]); // synergy full text
}
else if(evt.target.id.indexOf("recordDisplayLink2Component") != -1){
_gaq.push(['_trackEvent', "Synergy", "Articles access click", "Read article"]); //synergy article title
}
});
dojo.query('div#portfoliosAreaAnyComponent').connect('onclick', function(evt){
if(evt.target.parentNode.id.indexOf("changePortfolioLink2Component")){ // change portfolios
var labels = {'General': 'General portfolio focus',
'Business': 'Business portfolio focus',
'Literature': 'Literature Portfolio focus',
'Kids': 'Kids portfolio focus',
'Medical': 'Medical portfolio focus',
'Student': 'Student portfolio focus'};
if(evt.target.innerHTML.replace(/\s/g, "") in labels){ // innerHTML doesn't match
_gaq.push(['_trackEvent', "Synergy", "Portfolio selection", labels[evt.target.innerHTML]]);
}
}
});
});