I am trying to find a way to have a tour's url changed to included the current node's custom node ID, (or even just its default internal node ID) for tracking page views and user engagement time on individual nodes in Google Analytics 4 via google tag manager.
I have direct node access enabled and that works fine, but as I will be giving this tour to my client to host themselves, I can't manually type in an absolute url path for every single tour node hotspot (using "go to URL" action instead of go to next tour node) as I don't know that will be, and could potentially change at some point, breaking the tour.
I have seen and tried the code in the post that suggested using an action on node change with the following code:
Code: Select all
javascript: history.replaceState({}, player.userdata.title, location.href.replace(location.hash,"") + '#' + player.getCurrentNode());
Rather than mess around with immediately reloading the page each time a new tour node is click (which I think is being discounted by analytics because of the short interval between events) I would rather like to cleanly set my tour nodes to go directly to the correct tour node using direct node access.
I followed this tutorial as I think it is the closest thing I have found to what I am looking for: https://tonyredhead.com/pano2vr-little- ... is-is-home
In his example he uses the following action to access his home node:
Source: = Mouse Click
Action: = Go to URL
URL: = index.html#home
Target: = _self
This would be perfect except it isn't working for me. I have an action set up to "go to the the url": index.html#node3 (once I have this working I will use placeholders to implement this action across all the nodes)
When I click on the tour node, the URL changes from
http://localhost:49899/IVtepygf~1kiv6av/index.html
to
http://localhost:49899/IVtepygf~1kiv6av ... s=36762390
I don't know what the ?ts=36762390 part of the url means, and it the tour does not change to the specified node.
So my question is what am I doing wrong in trying to get this to work, if I should be approaching it a different way, or if what I am trying to do is even possible?
Thanks for your time and help,
Elaina