Suggestions for an iframe


Client of mine have a booking-module on their website that is a iframe. Naturally I would like to measure bookings but the booking modules vendor seems totally oblivious to this thing. I need to add some code and do a window.parent.postMessage in the iframe so I can capture info on the parent and then send to piwik. But the vendor doesn’t have any experience of this or will to help us here so I’m wondering: Can I add ask them to add the piwik snippet in the iframe and then on my own set up a custom js tag and set this up myself? Or will this screw anything up? I imaging that i don not fire any pageview tags or anything else in the iframe only listen to events in the iframe and fire window.parent.postMessage and have a script on the parent site that picks this up.


It depends on iframe setup, but I’m assuming it’s “firing” some script outside booking module iframe in your case.

Try creating some dataLayer.push with custom event and parameters, add it to postMessage part and test if you can pick it up with piwik tag manager without adding it to iframe. That’s what I would do - and then proceed to customize it to my needs.

You could add the whole container to the iframe but I think that you might have to still develop some sort of script that posts the information to the parent window. So it looks like the same kind of work as if you’d skip the container implementation.

For the “catching” part you could use one of the solution templates: