-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5832 from IQSS/develop
v4.14
- Loading branch information
Showing
112 changed files
with
171,869 additions
and
834 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
148 changes: 148 additions & 0 deletions
148
...x-guides/source/_static/installation/files/var/www/dataverse/branding/analytics-code.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
<!-- Global site tag (gtag.js) - Google Analytics --> | ||
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=YOUR ACCOUNT CODE"></script> | ||
<script> | ||
window.dataLayer = window.dataLayer || []; | ||
function gtag(){dataLayer.push(arguments);} | ||
gtag('js', new Date()); gtag('config', 'YOUR ACCOUNT CODE'); | ||
</script> | ||
<script> | ||
window.addEventListener("load", enableAnalyticsEventCapture, false); | ||
|
||
function enableAnalyticsEventCapture() { | ||
// Download button | ||
$(document).on("click", ".btn-download", function() { | ||
var category = $(this).text(); | ||
var label = getFileId($(this)); | ||
gtag('event', 'Download',{'event_category' : category, | ||
'event_label' : label}); | ||
}); | ||
|
||
// Request Access button | ||
$(document).on("click", ".btn-request", function() { | ||
var category = $(this).text(); | ||
var label = getFileId($(this)); | ||
gtag('event', 'Request Access', {'event_category' : category, | ||
'event_label' : label}); | ||
}); | ||
|
||
// Explore button | ||
$(document).on("click", ".btn-explore + 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() { | ||
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() { | ||
var category = $(this).text(); | ||
var label = getFileId($(this)); | ||
gtag('event', 'Preview', {'event_category' : category, | ||
'event_label' : label}); | ||
}); | ||
|
||
// Cite button | ||
$(document).on("click", ".downloadCitation + ul.dropdown-menu li a", function() { | ||
var category = $(this).text(); | ||
var label = 'Unknown'; | ||
if($('#fileForm').length > 0) { | ||
label = stripId($('#fileForm').attr('action')); | ||
} else if($('#datasetForm').length > 0) { | ||
label = stripId($('#datasetForm').attr('action')); | ||
} | ||
gtag('event', 'Download Citation', {'event_category' : category, | ||
'event_label' : label}); | ||
}); | ||
|
||
// Export Metadata button | ||
$(document).on("click", ".btn-export + ul.dropdown-menu li a", function() { | ||
var category = $(this).text(); | ||
var label = 'Unknown'; | ||
if($('#fileForm').length > 0) { | ||
label = stripId($('#fileForm').attr('action')); | ||
} else if($('#datasetForm').length > 0) { | ||
label = stripId($('#datasetForm').attr('action')); | ||
} | ||
gtag('event', 'Export Metadata', {'event_category' : category, | ||
'event_label' : label}); | ||
}); | ||
|
||
// Contact button | ||
$(document).on("click", ".btn-contact", function() { | ||
var category = $(this).text(); | ||
var label = 'Unknown'; | ||
if($('#fileForm').length > 0) { | ||
label = stripId($('#fileForm').attr('action')); | ||
} else if($('#datasetForm').length > 0) { | ||
label = stripId($('#datasetForm').attr('action')); | ||
} else if($('#dataverseForm').length > 0) { | ||
label = stripAlias($('#dataverseForm').attr('action')); | ||
} | ||
gtag('event', 'Contact', {'event_category' : category, | ||
'event_label' : label}); | ||
}); | ||
|
||
// Share button | ||
$(document).on("click", 'div[id$="shareDialog"] a[class^="sharrre"]', function() { | ||
var sharrreVal = $(this).attr('class'); | ||
var category = sharrreVal.substring(sharrreVal.indexOf('-') + 1) ; | ||
var label = 'Unknown'; | ||
if($('#fileForm').length > 0) { | ||
label = stripId($('#fileForm').attr('action')); | ||
} else if($('#datasetForm').length > 0) { | ||
label = stripId($('#datasetForm').attr('action')); | ||
} else if($('#dataverseForm').length > 0) { | ||
label = stripAlias($('#dataverseForm').attr('action')); | ||
} | ||
gtag('event', 'Share', {'event_category' : category, | ||
'event_label' : label}); | ||
}); | ||
|
||
} | ||
|
||
function getFileId(target) { | ||
var label = 'Unknown'; | ||
if(target.parents('th').length>0) { | ||
//Special case - the Download button that downloads all selected files in the dataset | ||
label = 'file(s) from ' + stripId($('#datasetForm').attr('action')); | ||
} else { | ||
var row = target.parents('tr')[0]; | ||
if(row != null) { | ||
//finds the file id/DOI in the Dataset page | ||
label = $(row).find('td.col-file-metadata > a').attr('href'); | ||
} else { | ||
//finds the file id/DOI in the file page | ||
label = $('#fileForm').attr('action'); | ||
} | ||
label = stripId(label); | ||
} | ||
return label; | ||
} | ||
|
||
|
||
function stripId(label) { | ||
var index = label.indexOf('&'); | ||
if(index == -1) index = label.length; | ||
if(label.indexOf('persistentId=') >= 0) { | ||
label = label.substring(label.indexOf('persistentId=') + 13, index); | ||
} | ||
if(label.indexOf('fileId=') >= 0) { | ||
label = label.substring(label.indexOf('fileId=') + 7, index); | ||
} | ||
return(label); | ||
} | ||
|
||
function stripAlias(label) { | ||
var index = label.length; | ||
label = label.substring(label.indexOf('/dataverse/') + 11, index).split(/[?#]/)[0]; | ||
return(label); | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.