Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Statistics about a website's traffic

  • vipgroup
  • vipgroup's Avatar Topic Author
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 years 1 month ago #92914 by vipgroup
Statistics about a website's traffic was created 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
The topic has been locked.
More
11 years 1 month ago #92946 by helper
Replied by helper on topic Statistics about a website's traffic
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
The topic has been locked.
  • vipgroup
  • vipgroup's Avatar Topic Author
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 years 1 month ago - 11 years 1 month ago #92947 by vipgroup
Replied by vipgroup on topic Statistics about a website's traffic
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: 11 years 1 month ago by vipgroup.
The topic has been locked.
More
11 years 1 month ago #92949 by helper
Replied by helper on topic Statistics about a website's traffic
Can you attach the endpage.pstpl so that I can see how you are inserting?
The topic has been locked.
  • vipgroup
  • vipgroup's Avatar Topic Author
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 years 1 month ago - 11 years 1 month ago #92950 by vipgroup
Replied by vipgroup on topic Statistics about a website's traffic
Will be attached.
I use RedandGrey template.
Last edit: 11 years 1 month ago by vipgroup.
The topic has been locked.
More
11 years 1 month ago #92954 by helper
Replied by helper on topic Statistics about a website's traffic
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.
Code:
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
The topic has been locked.
  • vipgroup
  • vipgroup's Avatar Topic Author
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 years 1 month ago #92961 by vipgroup
Replied by vipgroup on topic Statistics about a website's traffic
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?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 years 1 month ago - 11 years 1 month ago #92967 by DenisChenu
Replied by DenisChenu on topic Statistics about a website's traffic
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
Code:
} catch( err ) {}
was modified to
Code:
} 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 , plugin development .
I don't answer to private message.
Last edit: 11 years 1 month ago by DenisChenu.
The topic has been locked.
  • vipgroup
  • vipgroup's Avatar Topic Author
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 years 1 month ago #93002 by vipgroup
Replied by vipgroup on topic Statistics about a website's traffic
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.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 years 1 month ago #93004 by DenisChenu
Replied by DenisChenu on topic Statistics about a website's traffic

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 , plugin development .
I don't answer to private message.
The topic has been locked.
  • vipgroup
  • vipgroup's Avatar Topic Author
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 years 1 month ago #93006 by vipgroup
Replied by vipgroup on topic Statistics about a website's traffic
The Yandex code looks like this -
Code:
<!-- 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>
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 years 1 month ago #93008 by DenisChenu
Replied by DenisChenu on topic Statistics about a website's traffic
Hello,

There are some line who need modification:
Code:
var yaParams = {};
->
Code:
var yaParams = {  };
Code:
new Ya.Metrika({id:20199256,
->
Code:
new Ya.Metrika({
id:20199256,
Code:
trackHash:true,params:window.yaParams||{ }});
->
Code:
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 , plugin development .
I don't answer to private message.
The following user(s) said Thank You: vipgroup
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose