Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/release-notes/6938-analytics-reload
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Custom Analytics Code Changes

You should update your custom analytics code to implement necessary changes for tracking updated dataset and file buttons. There was also a fix to the analytics code that will now properly track downloads for tabular files.

We have updated the documentation and sample analytics code snippet provided in [Installation Guide > Configuration > Web Analytics Code](http://guides.dataverse.org/en/latest/installation/config.html#web-analytics-code) to reflect the changes implemented in this version (#6938/#6684).
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

function enableAnalyticsEventCapture() {
// Download button
$(document).on("click", ".btn-download", function() {
$(document).on("click", ".btn-download, .btn-download.dropdown-toggle + ul.dropdown-menu li a", function() {
var category = $(this).text();
var label = getFileId($(this));
gtag('event', 'Download',{'event_category' : category,
Expand All @@ -26,23 +26,23 @@
});

// Explore button
$(document).on("click", ".btn-explore + ul.dropdown-menu li a", function() {
$(document).on("click", ".btn-explore, .btn-explore.dropdown-toggle + ul.dropdown-menu li a", function() {
var category = $(this).text();
var label = getFileId($(this));
gtag('event', 'Explore', {'event_category' : category,
'event_label' : label});
});

// Compute button
$(document).on("click", ".btn-compute", function() {
$(document).on("click", ".btn-compute, .btn-compute.dropdown-toggle + ul.dropdown-menu li a", function() {
var category = $(this).text();
var label = getFileId($(this));
gtag('event', 'Compute', {'event_category' : category,
'event_label' : label});
});

// Preview button
$(document).on("click", ".btn-preview", function() {
$(document).on("click", ".btn-preview, .btn-preview.dropdown-toggle + ul.dropdown-menu li a", function() {
var category = $(this).text();
var label = getFileId($(this));
gtag('event', 'Preview', {'event_category' : category,
Expand Down Expand Up @@ -110,7 +110,7 @@

function getFileId(target) {
var label = 'Unknown';
if(target.parents('th').length>0) {
if(target.parents('th, #actionButtonBlock .btn-access-dataset + ul.dropdown-menu').length>0) {
//Special case - the Download button that downloads all selected files in the dataset
label = 'file(s) from ' + stripId($('#datasetForm').attr('action'));
} else {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,7 @@ file.editFiles=Edit Files
file.editFilesSelected=Edit
file.editFile=Edit

file.actionsBlock=File Actions
file.accessBtn=Access File
file.accessBtn.header.download=Download Options
file.editBtn=Edit File
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
<!-- Explore tool links -->
<ui:repeat var="tool" value="#{DatasetPage.datasetExploreTools}">
<li>
<h:commandLink action="#{DatasetPage.explore(tool)}">
<h:commandLink styleClass="btn-explore" action="#{DatasetPage.explore(tool)}">
<h:outputText value="#{tool.getDisplayNameLang()}"/>
</h:commandLink>
</li>
Expand Down Expand Up @@ -234,7 +234,7 @@
<!-- Publish BTN -->
<h:outputLink value="#" disabled="#{DatasetPage.lockedFromPublishing}">
<c:if test="#{!(showSubmitForReviewLink or showReturnToAuthorLink)}">
<f:passThroughAttribute name="class" value="btn btn-default btn-access btn-publish #{DatasetPage.lockedFromPublishing ? 'disabled' : ''}"/>
<f:passThroughAttribute name="class" value="btn btn-default btn-access btn-publish dropdown-toggle #{DatasetPage.lockedFromPublishing ? 'disabled' : ''}"/>
<f:passThroughAttribute name="onclick" value="$(this).parent().find( 'li > a' ).trigger( 'click' );"/>
</c:if>
<c:if test="#{showSubmitForReviewLink or showReturnToAuthorLink}">
Expand Down
15 changes: 0 additions & 15 deletions src/main/webapp/file-download-button-fragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
disabled="#{(fileMetadata.dataFile.ingestInProgress or lockedFromDownload) ? 'disabled' : ''}"
actionListener="#{fileDownloadService.writeGuestbookAndStartFileDownload(guestbookResponse, fileMetadata, 'original')}">
<h:outputFormat value="#{bundle['file.downloadBtn.format.original']}">
<!-- TODO: FIX VALUE LENGTH OVERLAPS SUBMENU PULL-FLOAT -->
<f:param value="#{fileMetadata.dataFile.originalFormatLabel}"/>
</h:outputFormat>
</p:commandLink>
Expand Down Expand Up @@ -375,9 +374,6 @@
<p:commandLink styleClass="btn-request" rendered="#{!fileDownloadHelper.session.user.authenticated }"
process="@this"
onclick="PF('accessSignUpLogIn_popup').show()">

<!-- 4.2.1 - TODO: retest this on a dataset with fileRequest enabled and with some files restricted to the user -->

#{bundle['file.requestAccess']}
</p:commandLink>
</li>
Expand Down Expand Up @@ -411,7 +407,6 @@
title="#{fileMetadata.dataFile.fileAccessRequesters.contains(dataverseSession.user) ? bundle['file.accessRequested'] : bundle['file.requestAccess']}"
process="@this"
onclick="PF('accessSignUpLogIn_popup').show()">
<!-- 4.2.1 - TODO: retest this on a dataset with fileRequest enabled and with some files restricted to the user -->
<span class="glyphicon glyphicon-bullhorn"/><span class="sr-only">#{fileMetadata.dataFile.fileAccessRequesters.contains(dataverseSession.user) ? bundle['file.accessRequested'] : bundle['file.requestAccess']}</span>
</p:commandLink>
<!-- END: DATASET PG -->
Expand Down Expand Up @@ -550,14 +545,4 @@
<span class="glyphicon glyphicon-flash"/><span class="sr-only">#{bundle['file.compute']}</span>
</h:outputLink>
<!-- END: Compute Button *DATASET PG only*: -->

<script type="text/javascript">
function downloadFiles(url, filelist) {
filelist=filelist + ','; //Prevents last file from being dropped on server
var form = $('<form></form>').attr('action', url).attr('method', 'post').attr('enctype','text/plain');
form.append($("<input></input>").attr('type', 'hidden').attr('name', 'fileIds').attr('value', filelist));
//Submit and then remove form
form.appendTo('body').submit().remove();
}
</script>
</ui:composition>
12 changes: 11 additions & 1 deletion src/main/webapp/filesFragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,16 @@
disabled="#{DatasetPage.locked}">
<span class="glyphicon glyphicon-bullhorn"/> #{bundle['file.requestAccess']}
</p:commandLink>

<script type="text/javascript">
function downloadFiles(url, filelist) {
filelist=filelist + ','; //Prevents last file from being dropped on server
var form = $('<form></form>').attr('action', url).attr('method', 'post').attr('enctype','text/plain');
form.append($("<input></input>").attr('type', 'hidden').attr('name', 'fileIds').attr('value', filelist));
//Submit and then remove form
form.appendTo('body').submit().remove();
}
</script>
</f:facet>

<div class="col-xs-12 text-left small" jsf:rendered="#{fileMetadata.dataFile.filePackage and systemConfig.rsyncDownload
Expand Down Expand Up @@ -604,7 +614,7 @@
<!-- END: FILE LEVEL INLINE INDICATORS, MSG, ICON, ET AL -->


<div class="btn-group" role="group" aria-label="TODO: ACCESSIBILITY LABEL FILE LEVEL ACTIONS">
<div class="btn-group" role="group" aria-label="#{bundle['file.actionsBlock']}">

<!---Modular configure-->
<ui:fragment rendered="#{!widgetWrapper.widgetView
Expand Down