Check out the LimeSurvey source code on GitHub!

Statistics about a website's traffic

More
4 years 4 days ago #92914 by vipgroup
Dear colleagues!
Do you know, is it possible to use in LS any detailed statistics about a website's traffic, like Google Analytic, but I'd like to use another service - Yandex Metrika - it is a very advanced statistics service. I have copied the script of statistics service in a startpage.pstpl, but the copied script doesn't work correctly. Do you have any ideas, how and where should I copy the script of site statistics service?
BR, Andrew

Please Log in to join the conversation.

More
4 years 3 days ago #92946 by helper
Most good metrics/analytic scripts need to be on every page and usually towards the end of the page. Try putting your script in endpage.pstpl.
The following user(s) said Thank You: vipgroup

Please Log in to join the conversation.

More
4 years 3 days ago - 4 years 3 days ago #92947 by vipgroup
Thank you for the idea, I tried to put the script in endpage.pstpl, but the result is the same - the statistics service see the script, but the script doesn't work properly. It seems, that the reason is the .pstpl format of the file, due to information sending of statistics script is impossible - "Counter code is installed but no data is being received".
Any ideas else?
Last Edit: 4 years 3 days ago by vipgroup.

Please Log in to join the conversation.

More
4 years 3 days ago #92949 by helper
Can you attach the endpage.pstpl so that I can see how you are inserting?

Please Log in to join the conversation.

More
4 years 3 days ago - 4 years 3 days ago #92950 by vipgroup
Will be attached.
I use RedandGrey template.
Last Edit: 4 years 3 days ago by vipgroup.

Please Log in to join the conversation.

More
4 years 3 days ago #92954 by helper
This is totally crazy... BUT... I have workaround. I signed up for Yandex and created my own and experienced the same mess that you were going through - something in LimeSurvey is creating a mess out of the JavaScript that Yandex provides. Some of the things that I unsuccessfully tried included turning OFF the XSS filter, putting the script in the description, inside a question, etc. Nothing that I tried from the front-end works.

My workaround is to create a new PHP file (mine is located at .../application/unc/yandex.php) then do an include in the .../application/helpers/common_helper.php at about line 7839. I added the line with "Yii::import('application.unc.yandex.php');" just before the return of the function.
function getFooter()
{
    global $embedded;
 
    if ( !$embedded )
    {
        Yii::import('application.unc.yandex.php');
        return "\n\n\t</body>\n</html>\n";
    }
 
    global $embedded_footerfunc;
 
    if ( function_exists( $embedded_footerfunc ) )
        return $embedded_footerfunc();
}
The following user(s) said Thank You: vipgroup

Please Log in to join the conversation.

More
4 years 3 days ago #92961 by vipgroup
Dear Helper!
Thank you very much for the help, but I regret to say, that I did not succeed. I created a new PHP file yandex.php, where I copied Yandex counter code, it located also at /application/unc/. After I added the line with "Yii::import('application.unc.yandex.php');" in the function getFooter() in the common_helper.php, as you showed. And nothing - Yandex answer, that "counter code is not installed". I viewed the page source of any survey, there is no any Yandex counter code in survey :(
–źny other ideas?

Please Log in to join the conversation.

More
4 years 2 days ago - 4 years 2 days ago #92967 by DenisChenu
Can you prvide the script for copy/pasting.

Think there are some {} issue.

For example, for piwik (a really good stats tools, and free).
Need some modification:

The line
} catch( err ) {}
was modified to
} catch( err ) {  }

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
Last Edit: 4 years 2 days ago by DenisChenu.

Please Log in to join the conversation.

More
4 years 1 day ago #93002 by vipgroup
Dear DenisChenu!
Thank you for the idea, but I'd like to use exactly Yandex Metrika because it has such possibility, like webwisor - it shows all movements of a visitors (respondents in our case) like a movie on a web page. And if any respondent say, that something is working wrong in the survey, I can check all respondent's movements and conclude, what is the main reason of error. Usually there are some respondents' errors.

Please Log in to join the conversation.

More
4 years 1 day ago #93004 by DenisChenu

DenisChenu wrote: Can you provide the script for copy/pasting.


Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

More
4 years 1 day ago #93006 by vipgroup
The Yandex code looks like this -
<!-- Yandex.Metrika counter -->
<script type="text/javascript">
var yaParams = {};
</script>
 
<script type="text/javascript">
(function (d, w, c) {
    (w[c] = w[c] || []).push(function() {
        try {
            w.yaCounter20199256 = new Ya.Metrika({id:20199256,
                    webvisor:true,
                    clickmap:true,
                    trackLinks:true,
                    accurateTrackBounce:true,
                    trackHash:true,params:window.yaParams||{ }});
        } catch(e) { }
    });
 
    var n = d.getElementsByTagName("script")[0],
        s = d.createElement("script"),
        f = function () { n.parentNode.insertBefore(s, n); };
    s.type = "text/javascript";
    s.async = true;
    s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";
 
    if (w.opera == "[object Opera]") {
        d.addEventListener("DOMContentLoaded", f, false);
    } else { f(); }
})(document, window, "yandex_metrika_callbacks");
</script>
<noscript><div><img src="//mc.yandex.ru/watch/20199256" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
This code should be copied between <body></body>

Please Log in to join the conversation.

More
4 years 1 day ago #93008 by DenisChenu
Hello,

There are some line who need modification:
var yaParams = {};
->
var yaParams = {  };
new Ya.Metrika({id:20199256,
->
new Ya.Metrika({
id:20199256,
trackHash:true,params:window.yaParams||{ }});
->
trackHash:true,params:window.yaParams||{  }
});

Each time you have { or }, put a [space] or [line-feed] after (for {) or before (for }). Else Expression manager think it's a expression.

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 (or search sondages pro).
The following user(s) said Thank You: vipgroup

Please Log in to join the conversation.

More
4 years 1 day ago #93010 by vipgroup
DenisChenu, you are a genius, everything is working, thank you for your support!
Andrew

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form