Page 1 of 1
Pass in node ID to javascript call
Posted: Thu Jun 25, 2020 9:04 pm
by LProbert
I am running some javascript through a getURL action on my node hotspot skin element, and would like to pass in the name of the target node. Is this going to work?
Code: Select all
dataLayer.push({'event': 'tourNodeSelected','tourName':$(hu)});
Do you process the string in this field with the $(hu) ???
Re: Pass in node ID to javascript call
Posted: Thu Jun 25, 2020 9:10 pm
by LProbert
It doesn't look like it does work. I get this error:
Code: Select all
Uncaught ReferenceError: $ is not defined
How would I do this to pass meaningful information about the tour selection to Google Tag Manager?
Re: Pass in node ID to javascript call
Posted: Mon Jun 29, 2020 2:59 pm
by christoph
Placeholders cannot be used in Javascript code.
But you can get the information in other ways.
In your case (if you want to access hotspot information from within a hotspot template) you would use:
Code: Select all
javascript: dataLayer.push({'event': 'tourNodeSelected','tourName':me.hotspot.url});
Or if you wanted to access userdata of a node, use the player function - getNodeUserdata(), like:
Code: Select all
javascript: alert(player.getNodeUserdata().title);
Regards,
Christoph
Re: Pass in node ID to javascript call
Posted: Fri Jul 03, 2020 3:56 pm
by LProbert
I ended up using
But it's interesting how you suggested doing it. What is this 'me' object? Do you have more to the Javascript API documented anywhere?