The problem: when visitors first come to our site, with no cookie banner interaction, the initial page view and some other analytics data items are not getting captured or tracked. This seems to be because the GPLR happens on a “window loaded” event type which needs the adobedtm tag to load instantly. Well the adobedtm tag is blocked until a user consents to analytics cookies. So if the banner is accepted, but the GPLR has already been triggered, almost nothing is tracked on that first page view.
My potential fix, that did work to some extent, was to add another GPLR that used custom Javascript which would add an event listener to the cookie banner’s acceptance. If the banner was accepted or analytics were accepted on that first page view, then the GPLR would basically refire. This worked flawlessly with my testing. But when things were published to Production, we saw a different outcome. My only guess to this would be variances to certain users with slower internet speeds and the 2nd GPLR not getting recognized or firing in time. I attempted to enhance the script with some timeout delays to account for this, but nothing seemed to match the outcome of what I was experiencing of my personal testing of the new addition.
What are recommended approaches to making sure all data is captured on that first page view, after a user has accepted cookies?