You are here

File download

description

The file download module tracks files being downloaded on your site. For specific file extensions such as .pdf .doc .zip or .xls, fileDownload sends a santianoEvent everytime a file is downloaded and reports on its fileName and on the pageUrl where the user downloaded his file.

setup

Please refer to the container setup instructions

gtm tags

santianoEvent - File Download

santianoEvent - File Download
Tag Type : Custom HTML
Sends a santianoEvent / fileDownload anytime a user downloads a file (associated with <a> link)

  <script>
dataLayer.push({
     'event': 'santianoEvent',
     'eventCommand': 'fileDownload',
     'eventCategory': 'Download .' + {{clickFileExtension}} + 'file', 
     'eventAction': {{clickFileName}},
     'eventLabel': {{pageURL}},
     'eventSegment': undefined,
     'eventPartition': undefined
});
</script>
close

gtm triggers

Click - DOC Link Download

Click - DOC Link Download
Trigger Type : Click - Just Links
Anytime a user clicks on a '.doc' or '.docx' link
clickFileExtension matches RegEx ^docx?$

close
Click - JSON Link Download

Click - JSON Link Download
Trigger Type : Click - Just Links

clickFileExtension matches RegEx ^json$

close
Click - PDF Link Download

Click - PDF Link Download
Trigger Type : Click - Just Links
Anytime someone clicks on a pdf file
clickFileExtension equals pdf

close
Click - XLS Link Download

Click - XLS Link Download
Trigger Type : Click - Just Links
anytime a user clicks on a '.xls' or '.xlsx' file
clickFileExtension macthes RegEx ^xlsx?$

close
Click - ZIP Link Download

Click - ZIP Link Download
Trigger Type : Click - Just Links
any clicks on zip files
clickFileExtension equals zip

close

gtm variables

clickFileExtension

clickFileExtension
Variable Type : Custom Javascript
Provides the extension of the file being clicked

  function() {
// Gets the URLPath, Checks if it contains a "."
// Returns the extension of the file if found
    var urlpath = {{clickPath}};
	if (urlpath.includes(".") == 0) {
    	return undefined;
    } else {
    	var fileExtension = urlpath.substring(urlpath.lastIndexOf('.')+1);
        return fileExtension;
    }
}
close
clickFileName

clickFileName
Variable Type : Custom Javascript
Provides the filename of a file that is clicked

  function() {
// Gets the URLPath, Checks if it contains a "." 
  // (Beware of all potential .html pages or .aspx
// Returns the full Name of the file
    var urlpath = {{clickPath}};
	if (urlpath.includes(".") == 0) {
    	return undefined;
    } else {
    	var filename = urlpath.substring(urlpath.lastIndexOf('/')+1);
        return filename;
    }
}
close
clickPath

clickPath
Variable Type : Auto Event Variable
Provides the destination URL of a click

  Element URL
Component Type: Path
close
eventCommand

eventCommand
Variable Type : Data Layer Variable
santiano.io comes with its specific eventCommand : its naming scheme facilitates management and maintenance of events tags and ecommerce tags.

  Data Layer Variable Name  : eventCommand 
Data Layer Version : Version 2
close
pageUrl

pageUrl
Variable Type : URL
Provides the URL of the page being loaded

  Component Type : Full URL
close
santianoApacheV2.0Licence

santianoApacheV2.0Licence
Variable Type : Custom Javascript

    function() {
  // santiano.io is released under Apache V2.0 licence.
  // 
  // Copyright 2018 Santiano Consulting SAS (santiano.io)
  // 
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  // 
  // http://www.apache.org/licenses/LICENSE-2.0
  // 
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
    return 'santiano.io is released under Apache V2.0 licence';
  }
close

Download

	Measuring File Downloads

21 [fileName].doc
03 [fileName].xls
51 [fileName].pdf
22 [fileName].json

santianoEvent
-> 'fileDownload'