screen resolutions using javascript
I am maki开发者_运维技巧ng an application like Analytics, and want to find screen-resolution using JavaScript.
All the analytics tools, that are available right now (be it Google Analytics, Piwik, OWA, or any other), all of them provide screen-resolution detection.
How can I achieve the following?
EDIT: I think You all go wrong. I am making a tool similar to Analytics
EDIT 2: If you are familiar with Google Analytics, it provides with a tracking code (which is in JavaScript). When page gets loaded, script executes and you get a hit.
EDIT 3: I believe that community people got my question in wrong sense. I thought that everyone here would be familiar with Google Analytics code, But I think I have to show an example of how GA code looks like.
EDIT 4: Here how GA code looks like
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-123456789-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
window.screen.width
and window.screen.height
精彩评论