Hi,
It could be great to have a plugin for google analytics to know how many panoramas are viewed, the most viewed...
I think it's not very difficult to do it with some javascript.
Somebody has ever work on something like this ?
Regards,
Hi,
It could be great to have a plugin for google analytics to know how many panoramas are viewed, the most viewed...
I think it's not very difficult to do it with some javascript.
Somebody has ever work on something like this ?
Regards,
It depends, if you have multiple panoramas (virtual tour) or just single panoramas on each page.
if you use single panoramas or just want to know what virtual tour they visited without knowing the exact panoramas they looked then just put the regular analytics JS code on the page that holds that particular panorama.
if you are using multiple panoramas (virtual tour) on a single page then I am afraid Analytics won't help you there since it will only tell you the page they opened and not what panoramas they viewed but if you are familiar with PHP you can create a "image stream" and add the code to a MySQL database and have basic statistics.
but you will need to have all of your panoramas added to a MySQL database first.
something like on MySQL
CREATE TABLE `yourdatabse`.`panoramas` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR( 255 ) NOT NULL ,
`pano` VARCHAR( 255 ) NOT NULL ,
`visits` VARCHAR( 255 ) NOT NULL
) ENGINE = MYISAM
then populate this database
after this create a php file to "stream" the image and count the visits.
<?php
//a function to connect to MySQL its a bit old, but works :)
function connect($SQL) {
$dbhost = 'localhost';
$dbname = 'yourdatabse';
$dbuser = 'youruser';
$dbpasswd = 'yourpassword';
// we select a the database and connect to it
$conex = mysql_connect($dbhost,$dbuser,$dbpasswd) or die ("no se pudo conectar???");
mysql_select_db($dbname, $conex);
// this wil execute the query
$resultado = mysql_query($SQL,$conex);
if (!mysql_errno()){
return $resultado;
} else {
echo "MySQL error ".mysql_errno().": ".mysql_error()."\n<br>When executing:<br>\n".$SQL."\n<br>";
die();
}
}
// I got this from the internet, sorry I don't remember where, but I modified to fit Krpano needs
function LoadJpeg($imgname)
{
/* Attempt to open */
$im = @imagecreatefromjpeg($imgname);
/* See if it failed */
if(!$im)
{
/* Create a black image */
$im = imagecreatetruecolor(150, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* Output an error message */
imagestring($im, 1, 5, 5, 'Error loading panorama', $tc);
}
return $im;
}
$sql = "SELECT * FROM panoramas where id = ".$_GET['id'];
$result = connect($sql);
header('Content-Type: image/jpeg');
$row = mysql_fetch_array($result);
//update the visits
$sql = "update panoramas set visits=visits+1 where id = ".$row['id'];
connect($sql);
$img = LoadJpeg($row['pano']);
imagejpeg($img);
imagedestroy($img);
?>
Display More
then on krpano you call it like this
this code has not been tested, most of it I modified for this post also this code can be expanded to use cubes or any other panorama type, even multires, but I think that would be a lot or overwork for the server.
hopefully I explained myself and this could help others, but if you run into problems let me know I will try and help
ohh, nice I did a search a while ago and didn't find a way, this looks cool I am going to try and look at it maybe a plugin could be made of this :)
here it is :) the very first and limited version of this plugin :)
http://www.mundopano.com/test/tour.html
I can't actually know if its sending the data to my analytics account since i think it takes a few hours so I will say its *UNTESTED*
but it seems to work correctly :)
I will upload it to the plugins section :)
EDIT: I will actually wait until the data appears on my google analytics just to make sure everything works as it should, then I will upload it
Enjoy
Oh, great !
Can you tell us a little bit what do you parse and what do you send to analytics server ?
(edit: this is my 100st post ! )
I don't know wet what you have implemented, the only thing I see is
But I think we should put the UA code in a separate variable, something like
And ... if we can put a prefix, it could be great too ! like
The main idea of the prefix is to use the search function of analytics to show only the /pano/ part.
I use it for the outbound links, and it works very well.
My outbound link are generated like this
<a onclick="javascript:pageTracker._trackPageview('/outbound/article/www.kubische-panoramen.de');" href="http://www.kubische-panoramen.de/ppg11">Panoramagalerie</a>
And when somebody click on this links, analytics counts it and I know how many people clicks on this link ... inside /outbound/ part.
It could be great to have the same things for /pano/
Anyway, you program very fast, thanks !
The reason you only see that line is because its a plugin, everthing related to that is in there and you call it with this
wait(LOAD);
call(events.trackthis,/spot 1);
inside an action
the reason for the wait is because the plguin needs some "start" time, and the very first panorama gave me errrors, so i just put it in the spot 1 action.
and Its way easier to just pass the variables like I am doing right now, using the querystring and its the same thing as variables for the user.
the prefix is a good idea, I will implement it and then upload the plugin the data showed on my account :D
Regards
prefix added and plugin uploaded
call(events.trackthis,/spot 1);
You need the call action ? It's not necessary since 1.0.7, is it ?
I tried it without and got an error , maybe I did it wrong, but feel free to test it using the "o" key on the keyboard and debug mode on you should be able to see whats going on :)
Just thought I'd pass along this link to the Google Analytics for Flash
http://code.google.com/apis/analytics…ckingIntro.html
I've have this running inside of my krpano portfolio plug-in at http://cleartours.com/portfolio that tracks which pano people select. Its very helpful and Its easy for me to see how much time people are spending on each one of the panos.
Lee
---
Lee Evans
Cleartours, Inc.
Clear: this plugin uses the GA component, i am thinking its the same thing?
anyways, I really like your sliding thumbnails, is that a plugin you created ?
Yup, same thing... Sorry for the duplicate post.
Quick off-topic response... Plug-in was originally from http://flashden.net/item/full-screen-xml-gallery-vrt-v1/9091 that I ported to AS3 and made some mods on. If you need more details just send me a email or message
Lee
---
Lee Evans
ClearTours, Inc.
Still didn't succeed to get that module for Google analytics to work :( I included as explained by Shanti but nothing appears in my Analytics unless I know panoramas have a bunch of visits if I check webstat of my server !
Any idea what might be wrong ?
Thanks
Vincèn
Still nothing working correctly for Google Analytics to track correctly panos viewed during a virtual tour ?
Thanks
Vincèn
shanti this kicks much ass ! once you get it all figured out it is very easy to implement.
Vincen - i think this would work i will test tomorrow and let you know.
add this to your primary xml
<plugin name="analytics" url="analytics.swf?theTrackerCode=UA-1234567-1&Prefix=/cpdemo/&DebugMode=1" />
add a generic plugin to each pano's xml.
<plugin name="googleA" keep="false" onloaded="call(events.trackthis,/pano1)" />
<plugin name="googleA" keep="false" onloaded="call(events.trackthis,/pano2)" />
that should log visits to each pano and put them under cpdemo/pano1 and cpdemo/pano2
EDIT: this does not work. seems i can track first pano and everything else i want except additonal panos :(
Don’t have an account yet? Register yourself now and be a part of our community!