I'm not clear on if the Google Tag Manager Container
is automatically refreshed, and if so how.
The documentation states:
By default, your container becomes eligible to be refreshed every 12 hours. To manually refresh the container, use
ContainerHolder.refresh()
:
ContainerHolderSingleton.getContainerHolder().refresh();
This is an asynchronous call that will not return immediately. To reduce network traffic,
refresh()
may only be called once every 15 minutes, otherwise it will be a no-op.
It's the "becomes eligible to be refreshed every 12 hours" paired with the "To manually refresh" part that is tripping me up. As such I have two questions:
- Does Google Tag Manager attempt to refresh the
Container
every 12 hours? - If the answer to #1 is yes then where/how does this occur?
My assumption at this point is that the answer to #1 is "Yes".
My concern is that I'm not sure where this automatic refresh occurs and I only access the getContainer()
in the ContainerAvailableListener
and then cache the values. So if it's the getContainer()
call that triggers the update, like happens with the "swapping" of a new container, my implementation might not be refreshing.
Edit: My reason for asking is that the lifetime of my application can be quite long. I'm trying to determine if I need to manage container refreshes in my code or not.