A new plugin: Piwik for Limesurvey -- your comments appreciated.

Mehr
5 Jahre 2 Monate her #116615 von SteveCohen
Hi all,
This is my first post and development contribution. Hopefully the first of a few ideas I have!

I've developed a plugin to inject Piwik tracking code into the DOM. I've put the code on github at https://github.com/SteveCohen/Piwik-for-Limesurvey .

Comments very welcome --desired, actually, becuase I've mostly hacked this together using other plugins as examples... :unsure:

There've been a few requests for this over the years, and this might just help out with the open feature request )... or at least avoid the workarounds requiring users to edit pstl files.

Thanks,

Steve.
Folgende Benutzer bedankten sich: Ben_V, gantier

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners
Mehr
5 Jahre 2 Monate her #116629 von Mazi
Thanks for sharing your solution. Can you share a screenshot of the plugin settings?

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
5 Jahre 2 Monate her #116646 von SteveCohen
Sure; see attached. Pretty simple for the moment. "What should i put here?" is a link to the Piwik docs.
Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
5 Jahre 2 Monate her #116648 von SteveCohen
Mods, would you move this to the 'plugins' forum? My apologies for posting in the wrong place.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
5 Jahre 2 Monate her #116649 von Mazi

SteveCohen schrieb: Mods, would you move this to the 'plugins' forum? My apologies for posting in the wrong place.

Topic moved.

Thanks for sharing a screenshot. Just a short question: Does piwik track all surveys or would it be possible to enable tracking for certain surveys only like we do with the Google Analytics feature of Limesurvey?

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
5 Jahre 2 Monate her #116691 von SteveCohen

Mazi schrieb: Just a short question: Does piwik track all surveys or would it be possible to enable tracking for certain surveys only like we do with the Google Analytics feature of Limesurvey?

That's a limitation at the moment :). Currently the plugin will make Piwik track every survey, but disabling on a per-survey basis is on the roadmap. I'll try to get that done in the next week or so.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
5 Jahre 2 Monate her - 5 Jahre 2 Monate her #116854 von SteveCohen
How do you get per-survey settings in a beforeSurveyPage event? I've tried for a few days now and aren't making much progress, so I'll just ask!

I've managed to save it to the lime_plugin_settings table using this code, which allows admins to turn per-survey tracking on and off:
        public function beforeSurveySettings()
        {
            $event = $this->getEvent();
            $event->set("surveysettings.{$this->id}", array(
                'name' => get_class($this),
                'settings' => array(
                    'piwik_trackThisSurvey' => array(
                        'type' => 'select',
                        'options'=>array(0=>'No',
                            1=>'Yes'),
                        'default'=>$this->get('piwik_trackSurveyPages', null, null, false), //Default is whatever is set by the superadmin.
                        'label' => 'Collect web analytics data from respondents',
                        'current' => $this->get('piwik_trackThisSurvey', 'Survey', $event->get('survey'))
                    )
                )
            ));
        }

...How do I get the stored value back? i.e. within a beforeSurveyPage event, how do I query the current value of 'piwik_trackThisSurvey' for the survey that is currently being viewed?

I've tried various methods from other plugins but I only ever get NULL's back. I have confirmed the settings are being saved in the lime_plugin_settings table.

Any hints?
Letzte Änderung: 5 Jahre 2 Monate her von SteveCohen.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
5 Jahre 2 Monate her #116861 von DenisChenu
Thanks.

For public survey, i make a fork and pull.
But the problem is to have the "actual" page of the survey in beforeSurveyPage :). I think we need to get the actual page only in JS ;).

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
5 Jahre 2 Monate her - 5 Jahre 2 Monate her #116894 von SteveCohen
Thanks for your reply, Denis. :)

So the SurveyID isn't available in PHP using beforeSurveyPage?? Or am I misunderstanding?

If it's not available, I guess I could use AJAX to load the code. Something like:
  1. beforeSurveyPage adds adds JS script to make an AJAX request to a php script. This request includes the surveyID.
  2. The php file determines whehter the tracking code should be loaded, for example, returning true or false (Problem: what would the URL to this script be??)
  3. Once AJAX is done, if the result was true, add the tracking code.
  4. .
..Yuck! ;)

In the meantime, I've put my current code up ( https://github.com/SteveCohen/Piwik-for-Limesurvey ). This has placeholder code for the disable-per-survey feature.
Letzte Änderung: 5 Jahre 2 Monate her von SteveCohen. Begründung: Didn't need to include Denis' entire message in quote :)

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
5 Jahre 2 Monate her #116903 von DenisChenu
No,

surveyid are in the input : manual.limesurvey.org/BeforeSurveyPage
The surveyId is OK with beforeSurveyPage only. I think more for "welcome page", "thanks page", register page etc ....
For the GID/SID : we can use beforeQuestionRender.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
5 Jahre 2 Monate her #116955 von SteveCohen
Ah! Thank you Denis! That was the help I needed.

I've now added the SID code, so survey admins can now enable/disable tracking. I'll commit this to Github in a moment.

I'll look into beforeQuestionRender, too, for other pages and features of the plugin.
Folgende Benutzer bedankten sich: DenisChenu

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
5 Jahre 2 Monate her #116964 von DenisChenu
Hi,

:)

Added the link at : bugs.limesurvey.org/view.php?id=7565

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
3 Jahre 1 Monat her #148545 von Mazi
Why don't we add this one as a core plugin?

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
3 Jahre 1 Monat her #148612 von DenisChenu
I see a good reason currently : this plugin use hack with afterPluginLoad currently. This can be fixed now using beforeControllerAction, but must be done.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
3 Jahre 1 Monat her #148617 von Mazi

DenisChenu schrieb: I see a good reason currently : this plugin use hack with afterPluginLoad currently. This can be fixed now using beforeControllerAction, but must be done.

But that should be doable for the next major release I guess?!

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com
Want to use your survey offline -> www.offlinesurveys.com

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha