|
1 | 1 | @(dataset: Dataset, folderId: Option[String])(implicit user: Option[models.User]) |
2 | 2 | @import play.api.i18n.Messages |
| 3 | +@import services.AppConfiguration |
3 | 4 | <!-- |
4 | 5 | The sections of this file dealing with the multi file uploader library are loosely based on the demo |
5 | 6 | of the blueimp jQuery File Upload library. An open source project located here: http://blueimp.github.io/jQuery-File-Upload/ |
@@ -126,6 +127,7 @@ <h3 class="title"></h3> |
126 | 127 | <!-- The template to display files available for download --> |
127 | 128 | <script id="template-download" type="text/x-tmpl"> |
128 | 129 | {% for (var i=0, file; file=o.files[i]; i++) { %} |
| 130 | + {% logEvent(file.size); %} |
129 | 131 | <tr class="template-download fade"> |
130 | 132 | {% if (file.deleteUrl) { %} |
131 | 133 | <td> |
@@ -171,6 +173,22 @@ <h3 class="title"></h3> |
171 | 173 |
|
172 | 174 | <!-- The Templates plugin is included to render the upload/download listings - downloaded to make the resource local --> |
173 | 175 | <script src="@routes.Assets.at("javascripts/file-uploader/tmpl.min.js")"></script> |
| 176 | + |
| 177 | +<script> |
| 178 | + // Inject some info into templates for tracking |
| 179 | + @if(AppConfiguration.getAmplitudeApiKey != "") { |
| 180 | + tmpl.helper += ',logEvent=function(size){' + |
| 181 | + 'amplitude.logEvent("upload", {' + |
| 182 | + '"dataset_id":"@dataset.id",' + |
| 183 | + '"dataset_name":"@dataset.name",' + |
| 184 | + '"uploader_id":"@user.get.id",' + |
| 185 | + '"uploader_name":"@user.get.getMiniUser.fullName",' + |
| 186 | + '"length":size,' + |
| 187 | + '});}' |
| 188 | + } else { |
| 189 | + tmpl.helper += ',logEvent=function(){}' |
| 190 | + } |
| 191 | +</script> |
174 | 192 | <!-- The Load Image plugin is included for the preview images and image resizing functionality - downloaded to make the resource local --> |
175 | 193 | <script src="@routes.Assets.at("javascripts/file-uploader/load-image.all.min.js")"></script> |
176 | 194 | <!-- The Canvas to Blob plugin is included for image resizing functionality - downloaded to make the resource local --> |
|
0 commit comments