So I'm trying to get the orientationchange event in Adobe DTM to work and then fire an Adobe Analytics event. The built in orientationchange event in DTM is not working for me so I'm trying to implement my own solution. The code I've produced is:
(function () {
var width = screen.width,
height = screen.height;
setInterval(function () {
if (screen.width == height || screen.height == width) {
width = screen.width;
height = screen.height;
alert("Orientation Changed");
}
}, 50);
}());
This is working as long as I place it in the JavaScript section. As soon as I place it in the Adobe Analytics Custom Code section it ceases to work. Is there a way that I can get an Adobe Analytics event to fire from the JavaScript section (adding s.events="event11" didn't work for me) or get this code to work in the Adobe Analytics custom code section?
In order for data to be sent to Adobe Analytics, an image request must be fired. If you would like to send a specific event on orientation change, be sure to send an s.tl() request that triggers with the orientation event.
Keep in mind that this can potentially increase server calls to your site if someone decides they want to constantly change screen orientation.