Note: This documentation is for Opentracker's events engine, please contact us if you think you need an upgrade.

You can retrieve the session id and/or user id from the cookie

there are three cookies set by the opentracker javascript:

  1. A cookie orientated to keeping user data:
    _otui <random number client site>. <first visit start unix timestamp>. <previous visit start unix timestamp>. <current visit start unix timestamp>. <session count>. <life time event view count>
    
    _otui 1247376984.1279273569088.1279273569088.1279273569088.1.13

  2. A cookie orientated to keeping session data:
    _ots <session event view count>. <current visit start unix timestamp>. <previous event view unix timestamp>. <current event view unix timestamp
    
    _ots 13.1279273569088.1279273785569.1279273833718

  3. A cookie orientated to keeping referrer data:
    _otr <session first referrer event view unix timestamp>.<referrer url>
    
    _otr 1279273431384.http%3A//www.example.com/an/example/referrer.html

Pass the cookies

You have to read the cookie to pass us the sid and uid

sid = <current visit start unix timestamp>.<random number client site>
sid = 1279273569088.1247376984

uid = <first visit start unix timestamp>.<random number client site>
uid = 1279273569088. 1247376984

Reading a cookie using Javascript

You can read the content of a Opentracker cookie with the following functions:

_ot_uid() to get the user id

_ot_sid() to get the session id

 

Example

<!-- note: you can remove the defer attribute from the script tag to not worry about load on ready stuff -->
<script src="http://script.opentracker.net/?site=www.opentracker.net">
<script type="text/javascript">

//alert the user id
alert(_ot_uid());

//alert the session id
alert(_ot_sid());

</script>

We would love to hear your feedback. Please use the facebook comment box below