RH2022 Frameless + Analytics 4 and Tag Manager
Has anyone been able to successfully run google analytics and tag manager in the frameless output to catch search terms and internal (not embedded) videos?
I have been using the html5 output with no issues but trying to migrate to frameless is a bit frustrating.
I have the search terms defined correctly in the analytics setup (I can see them when i use my workaround aka refreshing). For the video, I am using tag manager to run an html5 video listener for any page with a video, which then loads the video metrics to send back to analytics if it detects <video> tags (basically - hey, is there any video here? Yes, okay, load the video capturing event in case they hit play.).
The behavior I am viewing in debug mode is that clicking on a TOC item does not register a new page in the tag assistant - so it doesn't record anything interaction on the page.
When i execute a search and then click on a result, the page loads with the search term appended to the end of the url. Now, this should trigger a new page view as the result is a new topic. And with the appended search term, google should generate a view_search_result event as well. But, Google does not see it, nor records the search term, until I manually refresh the page and then records the view_search_term event. This is an out of the box feature too.
This is the same behavior when I am trying to capture video events. The listener nor the video event are triggered until after I refresh the page manually (the google debug and assistant tool do not even register it as a new page).
In looking at the TOC for the frameless, I see that it's tied to the topicpage.js event upon click where as the html5 version was a regular link without any js. I am leaning towards this javascript as being the root cause of my pain.
Once again the search terms and tag manager codes work fine when you:
- Manually Refresh a page
- Navigate directly to the page by entering its url in the address bar
- Clicking on links to it within topics
Its just accessing a topic via the toc does it fail to register a new event other than page_view.
I have also tried moving the scripts around to call them from different places with no improvement. I also tested this same code with a html5 build and it captured everything correctly - so the code works.
