Quantcast
Channel: Piwik Forums - Support & Bugs
Viewing all articles
Browse latest Browse all 4243

How to get current visitor's information? (no replies)

$
0
0
How would I retrieve details about the current visitor using Javascript?

Lets say I want to get their location and then write it somewhere on my webpage. For example, I have a headline that says:

"Thanks for visiting us from ENTER THEIR STATE NAME"

I would want to be able to get this info during the page load in javascript/jquery. Something like this:

<h1>Thanks for visiting us from <span id="state"></span>.</h1>

<script type="text/javascript">
$(function(){
    var StateName = Piwik.GetThisVisitorInfo().Location.State; //--- I made this up, but how would I do this part?
   $("#state").text(StateName);
});
</script>

Thanks for any help.

Viewing all articles
Browse latest Browse all 4243

Trending Articles