PRODUCT - Marketo RTP dialog pop up
Passing along a question I got from my web team -
We have a business requirement to track Marketo RTP dialog pop-up's LOAD and CLICK events. We are trying to achieve this by calling two java script functions of the parent window. But, it is not working and also pop-up stops loading on the page.
This is what we are trying to do -
- Call parent window's function on pop-up load - onLoadEventDatalayer(parentPageURL)
- Call parent window's function on pop-up click - onClickEventDatalayer(parentPageURL)
The actual code is like this -
<script>
var parentURL = window.parent.location;
$( document ).ready(function() {
if(typeof window.parent.onLoadEventDatalayer(parentURL) === 'function') {
window.parent.onLoadEventDatalayer(parentURL);
}
$('#trwDialog > div > a').click(function(){
if(typeof window.parent.onClickEventDatalayer() === 'function') {
window.parent.onClickEventDatalayer();
}
});
});
</script>
Can someone please help us to get this resolved or guide us about the implementation approach.