Welcome to WebmasterWorld Guest from

Forum Moderators: DixonJones & mademetop

Message Too Old, No Replies

Attempt to create my own web stats service



9:48 am on Sep 9, 2009 (gmt 0)

5+ Year Member


I have taken an endeavor to create my own web traffic counter service, so far my learning were as follows

(1)information like current page, referral url, browser info, and system info can be extracted from client's browser using a java script code.

(2) Now there is one road block after this, called "same origin policy" according to which a a DOM script like JavaScript cannot be executed from if it is loaded from different domain name also if a script is from same domain then it cannot submit information to foreign URL.

(3)To accomplish above task we can use a dummy <img> tag which is pointing to one foreign php file, this file has ability to process the java script variables into database.

I can successfully run my counter under the same domain name but when it comes to different website the script fails to execute, i have followed all above concept.

Then there is one discrepancy from real example of statcounter an example script is here

<!-- Start of StatCounter Code -->
<script type="text/javascript">

<script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script><noscript><div class="statcounter"><a href="http://www.statcounter.com/" target="_blank"><img class="statcounter" src="http://c45.statcounter.com/#*$!#*$!/0/#*$!#*$!/1/" alt="free hit counter javascript" ></a></div></noscript>
<!-- End of StatCounter Code -->

In this script they are loading the variables from another domain called statcounter.com and then are no variable in img src line i can see which contains the user information.

Please help me to resolve this problem


Featured Threads

Hot Threads This Week

Hot Threads This Month