Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
globetrotter
Imagevue Expert
Topic Author
Posts: 844
Joined: 18 Oct 2006, 13:16

Statcounter

13 Feb 2016, 12:52

I want to install a statcounter on my page, but I have no idea into which place I must copy the code.

Last week I used the code below (in the footer). And I worked fine. Did I also use in Imagevue X2.
Code
<counters>
<!-- Start of StatCounter Code -->
<div style="display: none;">
<script type="text/javascript" language="JavaScript">
var sc_project=1234567;
var sc_invisible=0;
var sc_partition=12;
var sc_security="12345678";
</script>
<script type="text/javascript" language="JavaScript" src="http://www.statcounter.com/counter/frames.js">
</script>
</div>
<!-- End of StatCounter Code -->
</counters>
After I did a reset of imagevue X3, the code was disappeared of course.
I copied it back into the footer, but since then it won't work anymore??
What am I doing wrong? :?

Maybe my code is outdated? On the Statcounter site I saw other codes, but which one is the best for me?
http://statcounter.com/install-guides/

Other example:
Code
<a title="free hit counter"
href="http://statcounter.com/free-hit-counter/" target="_blank"><img
src="http://c.statcounter.com/1709496/0/03633824/0/"
alt="free hit counter" style="border:none;"></a>
But this one is visible?
Rene
http://www.globetrotternet.nl/
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13999
Joined: 30 Sep 2006, 03:37

Re: Statcounter

14 Feb 2016, 23:54

Where did you get that code from?
Code
<counters></counters>
First of all, the tags above are not valid html tags so not sure where you got them from. Also, where are you pasting this data?

One important thing to note, is that your stat counter will only count visits to where the visitor first arrived on your website. Imagevue X3 is an AJAX website, and therefore clicking around in the menu is "dynamic" and will not trigger your static counter javascript. It works with Google Analytics, because we have built-in support.
 
User avatar
globetrotter
Imagevue Expert
Topic Author
Posts: 844
Joined: 18 Oct 2006, 13:16

Re: Statcounter

15 Feb 2016, 17:07

I copied the code from a backup file of imagevue X2. Index.php or something?
But I also tried it without the <counter></counter> code.

I paste it in the bottom of the footer (in the panel). I did't now if I must remove the {{copy}}
But I think why it didn't work later anymore...I turned off the share buttons...so also my counter?

Today I made a Google Analytics account. And paste their code into the panel.
Will check later how that is working.
Rene
http://www.globetrotternet.nl/
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13999
Joined: 30 Sep 2006, 03:37

Re: Statcounter

15 Feb 2016, 23:14

globetrotter wrote:I copied the code from a backup file of imagevue X2. Index.php or something?
But I also tried it without the <counter></counter> code.
Ok, but not sure where the <counter> tag comes from ... It's not html anyway, and should not be there ...
globetrotter wrote:I paste it in the bottom of the footer (in the panel). I did't now if I must remove the {{copy}}
But I think why it didn't work later anymore...I turned off the share buttons...so also my counter?
It would be best to paste it in the custom JS section. Not sure why you would turn off share buttons or remove {{copy}}.
globetrotter wrote:Today I made a Google Analytics account. And paste their code into the panel.
Will check later how that is working.
Better. This will work for the dynamic ajax nature of the X3 application.
 
User avatar
GGANG
Experienced
Posts: 122
Joined: 02 Feb 2012, 11:01

Re: Statcounter

17 Feb 2016, 12:39

Recommend the stat from this site http://www.histats.com
Its works nicely and very easy to see the visitors goes around our website. {many more}
I've add the hidden asynchronous code into Setting > Page > Include > Content Append [html]
Or if you want to show the counter is visible, you can add the stat code to the footer as well.
Don't forget to add your IP address to the Excluded IPs section. Whenever you visit your website it will not be tracked by your counter.
Lets try!! You will love it. :D
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13999
Joined: 30 Sep 2006, 03:37

Re: Statcounter

17 Feb 2016, 22:57

GGANG wrote:I've add the hidden asynchronous code into Setting > Page > Include > Content Append [html]
Can you let me know the code? There is likely a better way than having the JS code embedded in the content on all pages.
 
User avatar
GGANG
Experienced
Posts: 122
Joined: 02 Feb 2012, 11:01

Re: Statcounter

18 Feb 2016, 04:46

This is a counter code I've add into Setting > Page > Include > Content Append.
Code
<!-- Histats.com  START  (aync)-->
<script type="text/javascript">var _Hasync= _Hasync|| [];
_Hasync.push(['Histats.start', '1,3296277,4,0,0,0,00010000']);
_Hasync.push(['Histats.fasi', '1']);
_Hasync.push(['Histats.track_hits', '']);
(function() {
var hs = document.createElement('script'); hs.type = 'text/javascript'; hs.async = true;
hs.src = ('http://s10.histats.com/js15_as.js');
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(hs);
})();</script>
<noscript><a href="http://www.histats.com" target="_blank"><img  src="http://sstatic1.histats.com/0.gif?3296277&101" alt="counter easy hit" border="0"></a></noscript>
<!-- Histats.com  END  -->
This screen shot is on the summery page of the stats.
Image
Image
Let me know if have something will goes wrong with X3.
Thank you.
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13999
Joined: 30 Sep 2006, 03:37

Re: Statcounter

18 Feb 2016, 10:35

I'm assuming it works already for you? That's alright, but I think I have a much more effective implementation for you. Go to settings -> custom -> custom javascript, and add the following:
Code
function x3_load(){
  $.getScript("http://s10.histats.com/js15_as.js");
}
function x3_load_page(){
  var _Hasync= _Hasync|| [];
  _Hasync.push(['Histats.start', '1,3296277,4,0,0,0,00010000']);
  _Hasync.push(['Histats.fasi', '1']);
  _Hasync.push(['Histats.track_hits', '']);
}
Should look like this:
Image
There are a few benefits: 1) The main javascript "js15_as.js" only gets loaded once. 2) The "tracking" script gets called dynamically on each page load, instead of having to inject all that code into content-prepend, which would add the code to each page. 3) Its more elegant and technically correct than adding scripts into the content include.

In the code above, your stats script gets loaded once after the X3 loads with x3_load(). Then the tracking for each page gets called dynamically with x3_load_page() each time a new X3 page is displayed. Let me know how it goes ...
 
User avatar
GGANG
Experienced
Posts: 122
Joined: 02 Feb 2012, 11:01

Re: Statcounter

21 Feb 2016, 11:00

Hi Karl,
Thank you for the script implementation. I've tried but unsuccessful. Also I've apply to add more line. Unfortunately my knowledge not enough for the javascript language.
Histats.com has provide 4 kinds of script code as the following.

Standard :
Code
<!-- Histats.com  START (hidden counter)-->
<script type="text/javascript">document.write(unescape("%3Cscript src=%27http://s10.histats.com/js15.js%27 type=%27text/javascript%27%3E%3C/script%3E"));</script>
<a href="http://www.histats.com" target="_blank" title="free webpage counters" ><script  type="text/javascript" >
try {Histats.start(1,860619,4,0,0,0,"");
Histats.track_hits();} catch(err){};
</script></a>
<noscript><a href="http://www.histats.com" target="_blank"><img  src="http://sstatic1.histats.com/0.gif?860619&101" alt="free webpage counters" border="0"></a></noscript>
<!-- Histats.com  END  -->
No Javascript :
Code
<!-- Histats.com  START (hidden counter) -->
<a href="http://www.histats.com" alt="free webpage counters" target="_blank" >
<img  src="http://sstatic1.histats.com/0.gif?860619&101" alt="free webpage counters" border="0">
<!-- Histats.com  END  -->
xhtml :
Code
<!-- Histats.com  START  (standard)-->
<script type="text/javascript">document.write(unescape("%3Cscript src=%27http://s10.histats.com/js15.js%27 type=%27text/javascript%27%3E%3C/script%3E"));</script>
<a href="http://www.histats.com" target="_blank" title="free webpage counters" ><script  type="text/javascript" >
try {Histats.start(1,860619,4,0,0,0,"00010000");
Histats.track_hits();} catch(err){};
</script></a>
<noscript><a href="http://www.histats.com" target="_blank"><img  src="http://sstatic1.histats.com/0.gif?860619&101" alt="free webpage counters" border="0"></a></noscript>
<!-- Histats.com  END  -->
async :
-> Asynchronous code , is the best solution for speed because the counter code will be loaded into a separate thread by visitors, is based on HTML 4.0 standard, will not slow down your website even if loaded at the top of the page (suggested for this code). <br>If the counter is visible, it will load the counter code inside the div id->"histats_counter" provided with the code.
Code
<!-- Histats.com  START  (aync)-->
<script type="text/javascript">var _Hasync= _Hasync|| [];
_Hasync.push(['Histats.start', '1,860619,4,0,0,0,00010000']);
_Hasync.push(['Histats.fasi', '1']);
_Hasync.push(['Histats.track_hits', '']);
(function() {
var hs = document.createElement('script'); hs.type = 'text/javascript'; hs.async = true;
hs.src = ('http://s10.histats.com/js15_as.js');
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(hs);
})();</script>
<noscript><a href="http://www.histats.com" target="_blank"><img  src="http://sstatic1.histats.com/0.gif?860619&101" alt="free webpage counters" border="0"></a></noscript>
<!-- Histats.com  END  -->
If you have a time. I would like you to help to consider that script. I hope will be helpful for other X3 users. I have my own domain. I don't use it now. You can use it for testing. I already installed X3.

If you agree, I will tell you login password and login to sub-account of histats.com for checking the stats.
Thank you.
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13999
Joined: 30 Sep 2006, 03:37

Re: Statcounter

21 Feb 2016, 23:49

All their code is bulky, that's why I compacted it ... All they are doing with their code is what I pasted in my code, and it would already be loaded "Asynchronously" after main page is loaded.

It's not working? I can check, but would need login to your panel, and possibly login to your histats account to check.
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13999
Joined: 30 Sep 2006, 03:37

Re: Statcounter

23 Feb 2016, 02:55

I fixed the code a bit, so it works now:
Code
window._Hasync = [];
function x3_load_page(){
  $.getScript("http://s10.histats.com/js15_as.js");
  window._Hasync.push(['Histats.start', '1,3353642,4,0,0,0,00010000']);
  window._Hasync.push(['Histats.fasi', '1']);
  window._Hasync.push(['Histats.track_hits', '']);
};
This stats-service apparently requires re-loading the js15_as.js file for each page, even for ajax-pages (like X3) when it's already loaded. For Google Analytics for example, you only load the script once, and set the track variables for each page. Seems a bit unnecessary, but OK ... With the code above you can track pages without injecting into the content for each page at least ...
 
User avatar
GGANG
Experienced
Posts: 122
Joined: 02 Feb 2012, 11:01

Re: Statcounter

24 Feb 2016, 21:15

Hi Karl,

Thank you very much for your help. Its works very fine with the javascript code.
Code
window._Hasync = [];
function x3_load_page(){
  $.getScript("http://s10.histats.com/js15_as.js");
  window._Hasync.push(['Histats.start', '1,1017640,4,0,0,0,00010000']);
  window._Hasync.push(['Histats.fasi', '1']);
  window._Hasync.push(['Histats.track_hits', '']);
};
Image

:idea: Recommend for X3 Users!
Start tracking your visitors in 1 minute! http://www.histats.com
Register your website
Pick a counter or hidden tracker.
Paste counter code in your website.

:!: Note: Replace your hidden code {from async tab} into line No.-4 {look at above code}
:arrow: Paste all lines into Setting -> Custom -> Custom Javascript.

Image
 
User avatar
masquefotos
Experienced
Posts: 140
Joined: 20 May 2011, 05:38

Re: Statcounter

25 Feb 2016, 06:54

Using another analyzer but I requiring an icon, so I spend this that is more complete and remains hidden.
Thanks to both
 
ArtyFilin
Posts: 20
Joined: 03 Feb 2011, 09:59

Re: Statcounter

16 Mar 2016, 09:52

Hi, everybody.
Set the counter of Yandex in settings/page/include in Prepend to the Content [html], but it does not work. Use tags <counters></counters>.

Counter code:
<!-- Yandex.Metrika counter -->
<script type="text/javascript">
(function (d, w, c) {
(w[c] = w[c] || []).push(function() {
try {
w.yaCounter26058345 = new Ya.Metrika({
id:26058345,
clickmap:true,
trackLinks:true,
accurateTrackBounce:true,
webvisor:true
});
} 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 = "https://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="https://mc.yandex.ru/watch/26058345" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->

What am I doing wrong?
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13999
Joined: 30 Sep 2006, 03:37

Re: Statcounter

16 Mar 2016, 10:56

ArtyFilin wrote:What am I doing wrong?
First of all, I am not quite sure where people get the idea they can just "glue" anything into the content of X3 pages. The CONTENT is meant for your actual html page content, not 3rd party scripts. Furthermore, even if it may work (because javascript can still get triggered inside the html), it's simply bad practice to add it like this. Finally, you are aware that X3 is a html5 AJAX application? It doesn't load pages when you click links, but instead just replaces the content with help of JS and html5. These 3rd party counters you guys are using are made to work for old-school traditional websites that load the ENTIRE PAGE for each link. If you want them to work for a modern app like X3, it requires some customizations.
ArtyFilin wrote:<counters></counters>
Where do you get that from? There is no such thing as a <counters> tag ...

I am not sure how yandex counter works, but you can try to add the below into your settings->custom->custom javascript. If it does not work, I need a link which documents how to add code for metrika ... I can't do this for you. Why not use Google Analytics? It is built-in to X3.
Code
function x3_load_page(){
$.getScript("https://mc.yandex.ru/metrika/watch.js");
(function (d, w, c) {
(w[c] = w[c] || []).push(function() {
try {
w.yaCounter26058345 = new Ya.Metrika({
id:26058345,
clickmap:true,
trackLinks:true,
accurateTrackBounce:true,
webvisor:true
});
} catch(e) { }
});
};