Skip to content
  • Procurement Portal
  • Support
  • Optimise IT
  • Phone Icon Print & Comms 0330 175 5588
  • Phone Icon MSP Sales 0303 003 3579
Logo White
  • Solutions
    • By capability
      • Managed services
      • Flexible resource
      • Project delivery
      • Technology purchases
    • By need
      • Extend your IT capabilities
      • Support your in-house IT team
      • Switch your MSP partner
      • Optimise cost & resources
    • By service
      • Cloud services
      • IT services
      • Cyber security
      • Voice & networks
      • Print & documents
      • All services
  • Who we help
    • Col1
      • SME
    • Col2
      • Enterprise
    • Col3
      • Public sector
  • Who we are
    • Col1
      • Our story
      • Our team
      • Our partners
      • Our support
      • ESG credentials
      • Careers
    • Insights
      • Blog
      • News
      • Press Coverage
      • Optimise IT
  • Customer stories
  • Get in touch
Espria Logo for Case Studies
  • Solutions
    • By capability
      • Managed services
      • Flexible resource
      • Project delivery
      • Technology purchases
    • By need
      • Extend your IT capabilities
      • Support your in-house IT team
      • Switch your MSP partner
      • Optimise cost & resources
    • By service
      • Cloud services
      • IT services
      • Cyber security
      • Voice & networks
      • Print & documents
      • All services
  • Who we help
    • SME
    • Enterprise
    • Public sector
  • Who we are
    • About
      • Our story
      • Our team
      • Our partners
      • Our support
      • ESG credentials
      • Careers
    • Insights
      • Blog
      • News
      • Press Releases
      • Optimise IT
  • Customer stories
  • Get in touch
  • Procurement Portal
  • Support
  • Print & Comms Phone Icon 0330 175 5588
  • MSP Sales Phone Icon 0330 175 5588

Posts by Former CEO

Cyber Hygiene: Stopping the Spread of Covid Cyber Crime

By Former CEO | June 24, 2022

Covid-19 led to a weakening of defences for many organisations that still haven’t recovered. Have you?

Read More

Rising Inflation & Energy Pricing – The Next Critical Stage of Crisis Leadership – Author, Alex Tupman CEO

By Former CEO | March 23, 2022

Just as government restrictions fully lifted, war in Ukraine loomed, leaving businesses worldwide to brace for the impact from associated inflation, energy price rises and continued supply chain disruption.

Read More

Customer Acquisition Trends in a Post-Pandemic World – Author, Alex Tupman CEO

By Former CEO | January 27, 2022

With the government’s ‘work from home’ guidance finally being lifted this week, busy office buildings, vibrant city centres and face to face customer interactions are on the horizon. But in this new era of digital delivery, are virtual customer interactions here to stay?

Read More
Logo Blue

Resources

  • Blog
  • News
  • Press Releases
  • Optimise IT
  • Book your Microsoft 365 assessment
  • Book your Microsoft Azure optimisation assessment

Access Links

  • Services
  • Sectors
  • Partners
  • Contact Us

Contact Details

  • 0330 175 5588
  • Ware - Head Office, Thundridge Business Park, Thundridge, Herts, SG12 0SS
  • St Ives, Suite 1 James Hall, Parsons Green, St Ives, Cambridgeshire, PE27 4AA
  • Suite 7, Alexandra House, Winchester Hill, Romsey, Hampshire SO51 7ND

Sign up to our newsletter

  • View my bill
  • Terms & conditions
  • Privacy policy
  • Policy statements
(function() { 'use strict'; // Initialize dataLayer if it doesn't exist window.dataLayer = window.dataLayer || []; // Function to push form submit event to dataLayer function pushFormSubmitEvent() { window.dataLayer.push({ 'event': 'form_submit', 'form_type': 'microsoft_booking', 'form_location': 'consultation_booking', 'form_id': 'booking_iframe', 'timestamp': new Date().toISOString() }); console.log('Microsoft Booking Form Submit Event Pushed to GTM'); } // Method 1: Listen for postMessage from Microsoft Booking iframe function setupPostMessageListener() { window.addEventListener('message', function(event) { // Check if message is from Microsoft Booking system if (event.origin.includes('outlook.office365.com') || event.origin.includes('bookings.office.com') || event.origin.includes('office365.com')) { console.log('Message received from booking system:', event.data); // Look for booking completion/submission indicators if (event.data) { // Check for various success indicators const data = typeof event.data === 'string' ? event.data.toLowerCase() : event.data; if (typeof data === 'string') { if (data.includes('booking') && (data.includes('success') || data.includes('complete') || data.includes('confirm'))) { pushFormSubmitEvent(); } } else if (typeof data === 'object') { if (data.type === 'booking_completed' || data.action === 'submit' || data.status === 'success' || data.event === 'booking_success' || data.messageType === 'booking_confirmed') { pushFormSubmitEvent(); } } } } }); } // Method 2: Monitor iframe URL changes (if accessible) function monitorIframeChanges() { const iframe = document.querySelector('iframe[src*="outlook.office365.com/book"]'); if (iframe) { // Try to monitor iframe for navigation changes let lastUrl = ''; const checkIframeUrl = function() { try { // This will fail due to CORS, but we can still detect some changes const currentUrl = iframe.contentWindow.location.href; if (currentUrl !== lastUrl) { lastUrl = currentUrl; // Check if URL indicates booking completion if (currentUrl.includes('success') || currentUrl.includes('complete') || currentUrl.includes('confirmation')) { pushFormSubmitEvent(); } } } catch (e) { // Expected to fail due to CORS, but iframe load events might still work } }; // Monitor iframe load events iframe.addEventListener('load', function() { console.log('Booking iframe loaded/navigated'); setTimeout(checkIframeUrl, 1000); }); // Periodic check (as backup) setInterval(checkIframeUrl, 2000); } } // Method 3: Monitor iframe height changes (booking systems often resize after submission) function monitorIframeResize() { const iframe = document.querySelector('iframe[src*="outlook.office365.com/book"]'); if (iframe) { let initialHeight = iframe.offsetHeight; let hasResized = false; const observer = new ResizeObserver(function(entries) { for (let entry of entries) { const newHeight = entry.contentRect.height; // If iframe significantly changes height after initial load, might indicate form submission if (Math.abs(newHeight - initialHeight) > 100 && !hasResized) { hasResized = true; console.log('Booking iframe resized significantly - possible form submission'); // Wait a bit more to see if it's a submission confirmation setTimeout(function() { pushFormSubmitEvent(); }, 2000); } } }); // Start observing after iframe loads iframe.addEventListener('load', function() { setTimeout(function() { initialHeight = iframe.offsetHeight; observer.observe(iframe); }, 1000); }); } } // Method 4: Enhanced interaction monitoring with focus detection function monitorUserInteraction() { const iframe = document.querySelector('iframe[src*="outlook.office365.com/book"]'); if (iframe) { let interactionStartTime = null; let hasInteracted = false; let focusTimeout = null; // Detect when user starts interacting with iframe iframe.addEventListener('mouseenter', function() { if (!interactionStartTime) { interactionStartTime = Date.now(); console.log('User started interacting with booking form'); } }); // Detect when iframe gains focus (user clicked inside) window.addEventListener('blur', function() { // Window lost focus, possibly because iframe gained focus if (interactionStartTime && !hasInteracted) { hasInteracted = true; console.log('User likely clicked inside booking iframe'); // Set up a longer timeout for form submission detection focusTimeout = setTimeout(function() { // Check if user is still interacting (form submission likely occurred) const interactionDuration = Date.now() - interactionStartTime; if (interactionDuration > 30000) { // 30 seconds of interaction console.log('Long interaction detected - likely form submission'); pushFormSubmitEvent(); } }, 45000); // Wait 45 seconds } }); // Cancel timeout if window regains focus quickly (user didn't submit) window.addEventListener('focus', function() { if (focusTimeout && (Date.now() - interactionStartTime) < 10000) { clearTimeout(focusTimeout); console.log('Quick focus return - probably not a form submission'); } }); } } // Method 5: Network activity monitoring (experimental) function monitorNetworkActivity() { // Monitor fetch/XHR requests that might indicate form submission const originalFetch = window.fetch; const originalXHR = window.XMLHttpRequest.prototype.open; // Intercept fetch requests window.fetch = function(...args) { const url = args[0]; if (typeof url === 'string' && (url.includes('outlook.office365.com') || url.includes('bookings.office.com'))) { console.log('Booking-related network request detected:', url); // If it's a POST request to booking endpoints, likely a form submission if (args[1] && args[1].method === 'POST') { setTimeout(function() { pushFormSubmitEvent(); }, 1000); } } return originalFetch.apply(this, args); }; } // Initialize all tracking methods function initializeTracking() { console.log('Initializing Microsoft Booking iframe tracking...'); setupPostMessageListener(); monitorIframeChanges(); monitorIframeResize(); monitorUserInteraction(); monitorNetworkActivity(); console.log('Microsoft Booking tracking initialized'); } // Wait for iframe to be available function waitForIframe() { const iframe = document.querySelector('iframe[src*="outlook.office365.com/book"]'); if (iframe) { initializeTracking(); } else { setTimeout(waitForIframe, 1000); } } // Start tracking when DOM is ready if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', waitForIframe); } else { waitForIframe(); } })();