Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Dienstag, 12. Mai 2009, 12:26

plugin for analytics

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,
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

Shanti

Fortgeschrittener

Beiträge: 301

Wohnort: Puerto Vallarta

Beruf: Web Developer

  • Nachricht senden

2

Dienstag, 12. Mai 2009, 20:51

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

Quellcode

1
2
3
4
5
6
 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.

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?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);
?>



then on krpano you call it like this

Quellcode

1
2
3
<action name="loadpano1">
loadpano(null,sphere=panoload.php?id=1,KEEPALL,BLEND(2));
</action>


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 *smile*

3

Mittwoch, 13. Mai 2009, 00:27

Hi Shanti,

Thanks for your answers.

I know PHP a little bit, I think I can understand this code (I'll have a look tomorrow)

But do you know there is a API for Google Analytics for Flash ? I've just found it.Have a look here and here.

I don't know yet if this API can be easily embed for stats of krPano
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

Shanti

Fortgeschrittener

Beiträge: 301

Wohnort: Puerto Vallarta

Beruf: Web Developer

  • Nachricht senden

4

Mittwoch, 13. Mai 2009, 06:01

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 :)

Shanti

Fortgeschrittener

Beiträge: 301

Wohnort: Puerto Vallarta

Beruf: Web Developer

  • Nachricht senden

5

Mittwoch, 13. Mai 2009, 08:19

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

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Shanti« (13. Mai 2009, 08:37)


6

Mittwoch, 13. Mai 2009, 10:20

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 ! :-) )
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

7

Mittwoch, 13. Mai 2009, 10:32

I don't know wet what you have implemented, the only thing I see is

Quellcode

1
<plugin name="analytics" url="analytics.swf?theTrackerCode=UA-2112336-5&DebugMode=1" />


But I think we should put the UA code in a separate variable, something like

Quellcode

1
trackerCode="UA-123456"


And ... if we can put a prefix, it could be great too ! like

Quellcode

1
prefix="/pano/"


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

Quellcode

1
<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/

Have a look here or here.

Anyway, you program very fast, thanks ! ;-)
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

Shanti

Fortgeschrittener

Beiträge: 301

Wohnort: Puerto Vallarta

Beruf: Web Developer

  • Nachricht senden

8

Mittwoch, 13. Mai 2009, 19:19

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

Shanti

Fortgeschrittener

Beiträge: 301

Wohnort: Puerto Vallarta

Beruf: Web Developer

  • Nachricht senden

10

Mittwoch, 13. Mai 2009, 20:18

call(events.trackthis,/spot 1);


You need the call action ? It's not necessary since 1.0.7, is it ?

http://krpano.com/docu/actions/#call
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

Shanti

Fortgeschrittener

Beiträge: 301

Wohnort: Puerto Vallarta

Beruf: Web Developer

  • Nachricht senden

11

Mittwoch, 13. Mai 2009, 20:22

I tried it without and got an error *sad* , maybe I did it wrong, but feel free to test it *smile* using the "o" key on the keyboard and debug mode on you should be able to see whats going on :)

12

Mittwoch, 13. Mai 2009, 20:54

No problem for me with this

Quellcode

1
events.trackthis(%1);
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

ClearTours

Anfänger

Beiträge: 18

Wohnort: Naperville, IL USA

Beruf: Architectural Photographer

  • Nachricht senden

13

Freitag, 29. Mai 2009, 05:54

Just thought I'd pass along this link to the Google Analytics for Flash

http://code.google.com/apis/analytics/do…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.

Shanti

Fortgeschrittener

Beiträge: 301

Wohnort: Puerto Vallarta

Beruf: Web Developer

  • Nachricht senden

14

Freitag, 29. Mai 2009, 07:43

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 ?

ClearTours

Anfänger

Beiträge: 18

Wohnort: Naperville, IL USA

Beruf: Architectural Photographer

  • Nachricht senden

15

Samstag, 30. Mai 2009, 20:31

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.

vincen

Schüler

Beiträge: 69

Wohnort: Grenoble, France

Beruf: Photo, ski, walk, outdoor activities

  • Nachricht senden

16

Montag, 2. November 2009, 14:52

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
http://www.skivr.com (my blog)
http://magasin.skivr.com (my online shop for all panoramas and photography stuffs)

vincen

Schüler

Beiträge: 69

Wohnort: Grenoble, France

Beruf: Photo, ski, walk, outdoor activities

  • Nachricht senden

17

Freitag, 19. Februar 2010, 13:33

Still nothing working correctly for Google Analytics to track correctly panos viewed during a virtual tour ?

Thanks

Vincèn
http://www.skivr.com (my blog)
http://magasin.skivr.com (my online shop for all panoramas and photography stuffs)

18

Dienstag, 5. Oktober 2010, 23:31

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 :(

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »VN2009« (5. Oktober 2010, 23:44)


Ähnliche Themen