Is there a way to use more than one Javascript command in "Go to URL"?

Q&A about the latest versions
Post Reply
HaraldJ
Posts: 156
Joined: Wed Oct 10, 2012 2:05 pm
Location: Surrey, United Kingdom
Contact:

It would be great if I could send a Google Analytics even when the viewer clicks on a link.

As going to a link stops the current site from working, I'd like to combine the "Go to URL" with a Google Analytics send command. I haven't found a way yet to combine the two in one Javascript command, so I'm wondering if there is a way to have more than one Javascript command in a "Go to URL action"!

What I would like to achieve is

Code: Select all

javascript:ga('send', 'event', 'Panoramas', me.player.userdata.title, 'My Event Text', 1); window.open("https://MyURL", "_blank");
Unfortunately, this kills the whole panorama by turning it into a big black rectangle.

Is there a way to either have more than one Javascript command in "Go to URL", or to combine the real "Go to URL" with a Google Analytics send?

Thanks!!!

Harald
Harald Joergens
Harald Joergens Photography
Nutfield, Surrey, United Kingdom
User avatar
Hopki
Gnome
Posts: 13005
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi Harald,
You are looking to do Google event tracking right?
You can use script like this:

Example a Pan Left button - Mouse Click => Go To URL => URL: javascript:_gaq.push(['_trackEvent', '$ud', 'Pan Left']); => Target: (leave blank)
The $ud will pick up the text in the user dater description text box so you can enter the node tour.

Regards,
Hopki
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
HaraldJ
Posts: 156
Joined: Wed Oct 10, 2012 2:05 pm
Location: Surrey, United Kingdom
Contact:

Hi Hopki,

Thanks for your response. I don't have a problem with GA events in general, they work quite nicely. What I'm trying to achieve is specific to links:

I have logos in my panoramas that link to websites. The normal action on mouse click, "Go to URL", does just that, and works without any problems.
Now I would like to send a GA event as well:

On mouse click
- send GA event "link to XYZ clicked"
- go to XYZ

I haven't found a way to get both working. Any suggestion would be really appreciated!

Best regards

Harald
Harald Joergens
Harald Joergens Photography
Nutfield, Surrey, United Kingdom
User avatar
Hopki
Gnome
Posts: 13005
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi Harald,
You can add two goto URL actions to one button, on etc open the web page and one to send the tracing data.
Example:
Mouse Click => Go To URL => URL: javascript:_gaq.push(['_trackEvent', 'Name of tour', 'name of button']); => Target: (leave blank)
So nam elf button may be open website xxx
This will then be sent to Google and you will be able to see how many times the button was pressed in a visit, up to 500 hundred time per visit.
Regards,
Hopki
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
HaraldJ
Posts: 156
Joined: Wed Oct 10, 2012 2:05 pm
Location: Surrey, United Kingdom
Contact:

Hi Hopki,

Thanks, that's exactly what I did. And it does work - my problem was that the controller are was covering most of my logo, so clicking on it couldn't work!

All sorted now. But as I'm asking you questions: Google Javascript Console gives me two warnings about pano2vr_player.js:

Code: Select all

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

Code: Select all

SVG's SMIL animations (<animate>, <set>, etc.) are deprecated and will be removed. Please use CSS animations or Web animations instead.
Would it make any sense if I removed the two offending entries?

Thanks!

Harald
Harald Joergens
Harald Joergens Photography
Nutfield, Surrey, United Kingdom
Post Reply