Developing a plugin  

This sub-forum is for discussing and reporting bugs on any content that is not available by default in Panotour, so this concerns custom HTML templates, extra plugins (both Kolor-provided and third-party), etc...

Ce sous-forum a été créé pour discuter et/ou rapporter des bugs sur tout contenu qui n'est pas disponible par défaut dans Panotour, donc cela concerne les templates HTML customisés, plugins supplémentaires, etc...
no avatar
udrh
Member
 
Topic author
Posts: 47
Likes: 0 post
Liked in: 1 post
Joined: Mon May 13, 2013 5:12 am
Location: Australia
Info

Developing a plugin

by udrh » Fri May 29, 2015 1:56 am

Hi everyone,

I am trying to develop a basic google analytics plugin. However, I am having some difficulty getting started.

My initial goal is to set up an event listener that can respond with an action whenever a hotspot is clicked. Ideally some information about the hotspot can then be extracted and sent to google analytics.

As a starting point I’m thinking I could get a simple javascript plugin set up, with an analytics.xml file included by the PTP ‘include xml plugin’. Example ‘analytics.xml’ code:
Code: Select all
<plugin alturl="my_analytics.js" name="my_analytics" keep="true">
</plugin>
<events name="my_load_events" onxmlcomplete="plugin[my_analytics].testfunction1();" keep="true"/>

I’ve had a bit of a go with using the krpano javascript template as the ‘my_analytics.js’, but I can’t get access any functions, as I keep getting ‘unknown action’.

Any ideas where I’m going wrong?
Thanks,
Michael

no avatar
benji33
Kolor Team
 
Posts: 5848
Likes: 92 posts
Liked in: 199 posts
Joined: Tue Apr 09, 2013 10:59 am
Location: France
Info

Re: Developing a plugin

by benji33 » Mon Jun 01, 2015 9:45 am

Difficult to respond without a little bit more informations.

Your my_analytics.js file is a krpano plugin ?
Benjamin

no avatar
udrh
Member
 
Topic author
Posts: 47
Likes: 0 post
Liked in: 1 post
Joined: Mon May 13, 2013 5:12 am
Location: Australia
Info

Re: Developing a plugin

by udrh » Fri Jun 19, 2015 5:07 am

Hi, thanks for your reply.

Yes, I'm trying to use the krpano javascript plugin template (http://krpano.com/docu/plugininterface/#js) as the 'my_analytics.js' file.

I have created a basic PTP test tour. As part of this I am using the 'include xml' PTP plugin to include an xml file ('analytics.xml') which has the few lines of code to set up a javascript plugin (see my first post). At the moment, the 'my_analytics.js' contents are identical to the 'plugintemplate.js' from the krpano site, but I'd like to have something that works so I have something to build on.

I'm running into trouble when I try to call any functions from the plugin, where I get an error saying:

Code: Select all
WARNING: unknown action: plugin[my_analytics].testfunction1

I don't know if something with the javascript template needs to be changed for PTP, or if my xml syntax for creating the plugin or calling functions is wrong, or something else entirely.

Thanks again,
Michael

no avatar
benji33
Kolor Team
 
Posts: 5848
Likes: 92 posts
Liked in: 199 posts
Joined: Tue Apr 09, 2013 10:59 am
Location: France
Info

Re: Developing a plugin

by benji33 » Thu Jul 23, 2015 9:53 am

Is it possible to have a zip of the generated tour to help you with the code ?
Benjamin

no avatar
udrh
Member
 
Topic author
Posts: 47
Likes: 0 post
Liked in: 1 post
Joined: Mon May 13, 2013 5:12 am
Location: Australia
Info

Re: Developing a plugin

by udrh » Thu Oct 15, 2015 5:57 am

Hi again,

Sorry for the lengthy delay in posting a followup. In coming back to this after a long absence, I'm trying a different approach which looks like it could be an easy way to get at least some basic view stats.

In the html page I've got the standard Google Analytics embed script in the <head> part of the html page.

In PTP I am using the 'Call actions on tour events' free plugin, and for the 'React when the panorama starts, after introduction effects' option I have the following 'Call a javascript action' js code:
Code: Select all
ga("send","event","panorama","load",%p);

This sends event data to my analytics account all fine (hooray!). However, the %p keyword isn't resolving as the panorama name ('%p' is all that goes to analytics). Do you know what I could use instead of %p to show the current panorama name?

Cheers,
Michael

User avatar
Cliquetsy
Member
 
Posts: 1312
Likes: 106 posts
Liked in: 119 posts
Joined: Thu May 16, 2013 4:10 pm
Info

Re: Developing a plugin

by Cliquetsy » Thu Oct 15, 2015 7:04 am

I won't be able to help you with the code but I just want to point out that PTP 2.5 beta has an analytics plugin, have you checked it out?

no avatar
udrh
Member
 
Topic author
Posts: 47
Likes: 0 post
Liked in: 1 post
Joined: Mon May 13, 2013 5:12 am
Location: Australia
Info

Re: Developing a plugin

by udrh » Thu Oct 15, 2015 10:05 am

No I wasn't aware - I'll have a look tomorrow.

no avatar
Vishal Mathur
Member
 
Posts: 19
Likes: 8 posts
Liked in: 1 post
Joined: Tue Jan 05, 2016 3:12 pm
Location: New Delhi
Info

Re: Developing a plugin

by Vishal Mathur » Mon Jan 11, 2016 8:14 am

Cliquetsy wrote:I won't be able to help you with the code but I just want to point out that PTP 2.5 beta has an analytics plugin, have you checked it out?


Hi, I'm running PTP2.3.2, I can't view the Analytics plugin in the style library, any idea where to find it?
Also while I try to check for updates for PTP 2.3.2 to upgrade to PTP 2.5 beta, the message says you are already running on the most updated version.How to upgrade to to PTP2.5 beta to use Analytics pluggin?

User avatar
Annis
Kolor Team
 
Posts: 6062
Likes: 801 posts
Liked in: 444 posts
Joined: Mon Aug 12, 2013 12:47 pm
Location: France
Info

Re: Developing a plugin

by Annis » Mon Jan 11, 2016 9:22 am

Vishal Mathur wrote:
Cliquetsy wrote:I won't be able to help you with the code but I just want to point out that PTP 2.5 beta has an analytics plugin, have you checked it out?


Hi, I'm running PTP2.3.2, I can't view the Analytics plugin in the style library, any idea where to find it?
Also while I try to check for updates for PTP 2.3.2 to upgrade to PTP 2.5 beta, the message says you are already running on the most updated version.How to upgrade to to PTP2.5 beta to use Analytics pluggin?


The Analytics plugin is in v2.5, so you will not find it in your 2.3 version..
Since it is not a stable release, it doesn't yet count as an update until the final version, then you will be able to find it by searching for updates.
You can download v2.5 from the bottom of the Panotour downloads page (http://www.kolor.com/panotour/download/#beta).


Who is online

Users browsing this forum: No registered users and 1 guest

cron