When visitors view PDF assets within PathFactory Content Tracks, our native PDF Viewer provides the Download and Print options. The following code can be leveraged to prevent unknown visitors from downloading PDFs until they are known in PathFactory. This will prevent visitors from accessing the PDFs without having a known email address associated with their PathFactory engagement data.
To see more examples of code snippets, read Frequently Used External Code Snippets to Personalize Your PathFactory Experiences.
Below is an example of a form for an Unknown Visitor.
Below is the Experience appearance for a Known Visitor (no form pops up).
Where to place the script?
This script can be added through your External Code library and you can find a step by step guide on how to do so in our article Using External Code. The location can be set to either of the ‘Head Tag’ or either of the ‘Body Tag’ options. This can be applied globally to any PathFactory instance.
Code Snippet
<style id=”pdfDlHide” type=”text/css”>
#toolbarViewerRight #download,
#toolbarViewerRight #print {
display: none!important;
}
</style>
<script>
handleJukeboxDispatchedEvents_show_dl = function (event) {
switch (event.detail.eventName) {
case “load_show”:
if (“{{visitor.email}}” != “”) {
document.querySelector(‘#pdfDlHide’).type = ‘text/plain’;
}
break;
}
}
window.addEventListener(“pf_event”, this.handleJukeboxDispatchedEvents_show_dl, false);
</script>
Views: 5