Hi,
I'm trying to set up download tracking via Google Tag Manager. I have already set the tag and as trigger I'm trying to use an event in the datalayer.
This work:
function ready (scene) {
parent.dataLayer.push ({'event': 'pdf-download'});
} ready;
The 'pdf-download' event is pushed and the tag fires. But it activates on flipbook viewing, not on pdf downloading. So now I have to intercept the click event on the download button and my knowledge of javascript is limited.
I try this:
function ready (scene) {
$('.cmdSave a').click (function (e) {
parent.dataLayer.push ({'event': 'pdf-download'});
});
} ready;
It doesn't works, the event is not triggered by clicking the download button in the flipbook. Any suggestions?
ok i figured out:
function ready(scene) { jQuery(scene.view.getContainer()).find('.cmdSave').click(function(){ parent.dataLayer.push({ 'event': 'pdf-download' }); }); } ready;Is there a way to make this change on all books and not have to do it on each one? Thanks
Yes, use ready function from settings - it works globally.