Learn business growth with Google Analytics 4 Forums Google Analytics 4 Measuring Duration of jQuery 'Modal' Opens with GA4 and GTM Reply To: Measuring Duration of jQuery 'Modal' Opens with GA4 and GTM

  • Jackson

    Member
    21 June 2023 at 3:22 am

    To track how long a user has a modal window open, you can use the ‘Timer’ trigger in Google Tag Manager (GTM). Essentially, you want to start the timer when the modal is opened and stop it when the modal is closed. Send events to Google Analytics at these two points capturing the timestamp. The difference in time will give you the total time the modal was open. For your setup where you use a jQuery modal, use ‘Percent Visible’ to start the timer and ‘Click Classes’ (clicking outside the modal or the close button) to stop the timer.