Google Analytics and virtual tours

Q&A about the latest versions
User avatar
jare
Posts: 365
Joined: Thu Mar 19, 2009 1:26 pm
Location: RU/CZ
Contact:

Is there any way to send Google Analytics virtual tour's events like hotspots or other element click?
Don
Posts: 143
Joined: Thu Mar 07, 2013 2:59 pm
Location: Southern California

See "Anatomy of Event Tracking" on this page. Their first example shows how to record user interaction with a video Play link on your page.
https://developers.google.com/analytics ... ackerGuide

Perhaps the "video Play link" could be your hotspot url action instead, or something like that...
User avatar
hum@no.id
Posts: 945
Joined: Sat Sep 09, 2006 10:35 pm
Location: Dark side of the Moon
Contact:

Hi!

Direct node access and link type - index.html#node2 (like as bookmark)
this link event tracking or not?
Gumir J | VR Panoramic Photographer | mobile: +77055717171 | skype: gumirj
website: gumirj.com | google.com/+gumirj | facebook.com/gumirj | twitter.com/gumirj
User avatar
jare
Posts: 365
Joined: Thu Mar 19, 2009 1:26 pm
Location: RU/CZ
Contact:

I think direct node access won't help because the url doesn't change itself by clicking hotspots inside tour.
User avatar
Hopki
Gnome
Posts: 13005
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi,
Yes there is, use Google tracking.

Also have a look at:
Website: http://www.google.com/analytics/

Event Tracking Website:
https://developers.google.com/analytics ... ackerGuide

You can track 500 items per person per visit.


Use a Go To URL action then use: Go To URL => URL: javascript:_gaq.push(['_trackEvent', 'MyCat', 'my action']);
an example of a Pan Left button:

Mouse Click => Pan Left => Speed: 0.5
Mouse Click => Go To URL => URL: javascript:_gaq.push(['_trackEvent', '$ud', 'Pan Left']); => Target (leave blank)

The above will show how many times a person has clicked the pan left button, the $ud is used so you know which tour it is that is being viewed.
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/
User avatar
jare
Posts: 365
Joined: Thu Mar 19, 2009 1:26 pm
Location: RU/CZ
Contact:

Thanks a lot, Martin.
I tried that action Mouse Click => Go To URL => URL: javascript:_gaq.push(['_trackEvent', '$ud', 'Pan Left']); => Target (leave blank) but browser loads a blank page.
User avatar
jare
Posts: 365
Joined: Thu Mar 19, 2009 1:26 pm
Location: RU/CZ
Contact:

Does someone know working way to call the javascript from pano? Now the browser opens blank page.
User avatar
Hopki
Gnome
Posts: 13005
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi Jare,

Your page code should look like this, in the head of your page:

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'your google account code goes here']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>


In the user data of each Panorama add The Title of each node and in the description add the panorama group name e.g. House one.
To track nodes, add the following to the Hotspot Template - Loaded => Go To URL => javascript:_gaq.push(['_trackEvent', '$ud', '$ut']); Target: (leave blank)


To track a button click in the skin, Example a Pan Left button - Mouse Click => Go To URL => URL: javascript:_gaq.push(['_trackEvent', '$ud', 'Pan Left']); => Target: (leave blank)

Hope this helps.
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/
User avatar
jare
Posts: 365
Joined: Thu Mar 19, 2009 1:26 pm
Location: RU/CZ
Contact:

jare wrote:Now the browser opens blank page.
Just a little update: a blank page with one 0 (zero) digit opens only in Firefox and IE.
In Opera, Google Chrome and Safari the javascript works without problems.
Can someone try to reproduce and report your results in various browsers here, please?
Test panorama here, just click the white rectangle.
Thanks!

This is what I see in FF and IE:
Attachments
Untitled-1.jpg
Untitled-1.jpg (77.38 KiB) Viewed 10272 times
User avatar
hum@no.id
Posts: 945
Joined: Sat Sep 09, 2006 10:35 pm
Location: Dark side of the Moon
Contact:

Hi Hopki!
It will be very great if you add a public example (project files) on a subject. It will be interesting to all

thnx for great work
Gumir J | VR Panoramic Photographer | mobile: +77055717171 | skype: gumirj
website: gumirj.com | google.com/+gumirj | facebook.com/gumirj | twitter.com/gumirj
User avatar
jare
Posts: 365
Joined: Thu Mar 19, 2009 1:26 pm
Location: RU/CZ
Contact:

One more strange thing - HTML5 output and normal.ggt template works fine with my script. But if a fullscreen checkbox is checked, the browser does not display anything but this report "This content requires HTML5/CSS3, WebGL, or Adobe Flash Player Version 9 or higher." Tested in Safari, Chrome and Firefox.
It will be very great if you add a public example (project files) on a subject. It will be interesting to all
+1
Don
Posts: 143
Joined: Thu Mar 07, 2013 2:59 pm
Location: Southern California

Wish I had more time, here are a couple of quick observations. Maybe they help?
1. Try this:

Code: Select all

javascript:_gaq.push(['_trackEvent', $ud, 'Pan Left']); 
instead of this:

Code: Select all

javascript:_gaq.push(['_trackEvent', '$ud', 'Pan Left']); 
because $ud is a variable. Putting quotes around a variable makes it literal.

2. Try this:

Code: Select all

ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://') + '.google-analytics.com/ga.js';
instead of this:

Code: Select all

ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
because your web site is in a sub-domain (http://3dpano.pindora.com/public/ga/1.html) and "document.location.protocol" seems to behave differently in different browsers.

REFERENCES:
A. First time Google Analytics users see this: https://developers.google.com/analytics ... ncTracking
B. Advanced Google Analytics users see this: https://developers.google.com/analytics ... ngOverview
User avatar
jare
Posts: 365
Joined: Thu Mar 19, 2009 1:26 pm
Location: RU/CZ
Contact:

It seems the problem is resolved, I tried the same code again in HTML5+flash fallback panorama, then everything works.
Now I'll try to apply the Event Tracking to a real tour.

Thanks to all!
User avatar
jare
Posts: 365
Joined: Thu Mar 19, 2009 1:26 pm
Location: RU/CZ
Contact:

Again bad news, again the same blank page in FF and IE.
Hopki, Thomas, haven't you a working example?
because $ud is a variable. Putting quotes around a variable makes it literal.
All the same even without variables
because your web site is in a sub-domain
All the same in main domain
User avatar
thomas
Chief Gnome
Posts: 2611
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

I have now looked into this, and I guess the problem is how google uses the async queue. You can work around this by adding a Javascript function that sends the data to the GA queue, and you call that function within Flash.
I used the following code where I added a gaTrackEvent function:

Code: Select all

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXX-X']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


	function gaTrackEvent(a,b,c) {
		_gaq.push(['_trackEvent', a, b, c]);
	}
</script>
and in the skin I call

Code: Select all

javascript:gaTrackEvent( 'Test', 'Click', 'Text1');
You can see this working at: http://gardengnomesoftware.com/test/ga/ and you can download the whole project here.
Attachments
Screen shot 2013-09-06 at 12.36.14 .png
Screen shot 2013-09-06 at 12.36.14 .png (35.53 KiB) Viewed 10205 times
MfG, Thomas
Post Reply