Google Tag Manager

Forum Discussion

Tobias's avatar
Tobias
Active Member
4 months ago

Custom event as trigger to deactivate/hide IAM

Hello everyone, I am looking for a solution for the following case:

A user searches for a product via a form on our website, the search button is triggered with the custom event ‘Search_Item’. Now a short loading time of 6-15 seconds starts, which is bridged with a loading screen. During this time, I would like to display an in-app message (modal) depending on what was searched for. This also works. But the message remains after the search results are displayed, as there is no new page load. But a new event is triggered, namely ‘View_Item’, which should actually also display another in-app message as a slide-up. However, this is still suppressed as the old one does not disappear.

Is it possible to use trigger an event so that the In App Message (modal) disappears? If so, how? 

I've already tried a few things with Campaign and Canvas, but I can't make the IAM modal disappear, only if I set a time counter, but unfortunately that's not possible because the loading time fluctuates.

Thanks! 
Tobias

  • Manoj__'s avatar
    Manoj__
    Specialist II

    Hello Tobias It’s not possible to discard in-app messages programmatically—they require user interaction to be dismissed.

    For your use case, however, you could consider using content cards, which can expire after a set duration. The challenge lies in your 6-15 minute loading window. While content cards can expire and be reloaded, the expiration time remains static.

  • DavidO's avatar
    DavidO
    Strategist II

    Hey Tobias 

    You could potentially use custom JavaScript to load the modal and then set a timeout for the modal to be hidden. A couple of things though:

    1. This does not close the modal but hides it from view after a certain period of time, it is still 'loaded' on the page (this may potentially cause some issues to your actual page interactions, unsure)
    2. I have never tested this. It would need some thorough testing for your use case