Is it possible to terminate a visit on logout?


#1

Hello,
We have integrated piwik into our Joomla-based analytics reporting system, and have the following use-case:

  1. User logs into Joomla front-end
  2. User’s id and group memberships are tracked as custom session-scoped and page-scoped variables.
  3. Multiple users log in and log out of the Joomla front-end frequently from the same computer
  4. We would like to track each login as a unique visit, even if it falls within the session timeout

We are seeing the following:

  1. User A logs out of Joomla prior to session timeout
  2. User B logs into Joomla on the same computer, and then “usurps” the previous user’s visit, resulting in only 1 visit, attributed to User B

Ideally what would happen is:

  1. User A clicks on logout link
  2. Logout link has javascript function attached to call Piwik API to invalidate or terminate the visit
  3. User B logs in and a brand-new visit is logged, disregarding the Piwik session timeout

Is it possible to accomplish this use-case? Is there an API method available to terminate the visit?

Thanks!
Jack Harper
San Francisco, CA


#2

Hi, i need also help with something similar, i’ve posted 301 Moved Permanently some days ago but no answer yet. I need to create a new visit every time a user login and finish the visit when he logout. Can somebody hep me¿?


(vipsoft) #3

You could try deleting the visitor cookie on logout.


#4

Deleting the cookie actually didn’t work for me. I am wondering if “heuristics” are coming into play here. Here are the steps I took:

  1. Log into Joomla
  2. Verify that the cookies were created (three that begin with _pk)
  3. Manually delete these cookies from firefox
  4. Close browser, open browser
  5. Verify that cookies no longer exist
  6. Log into Joomla
  7. Check the piwik_log_visit table for a new record, but no new record is created

So it seems that something other than the cookie is coming into play when determining if a new visit has occurred. Is there perhaps a configuration that could be toggled to disable heuristics (if that’s even a possible cause)?

Any other suggestions of things to try?

Thanks for your help!
Jack


(vipsoft) #5

See config/global.ini.php. there may be a setting in the Tracker section to disable heuristic matching


(Matthieu Aubry) #6

To force a visitor to record a new visit

  1. change the “_id” parameter to another 16 hexadecimal visitor ID
  2. and change the user resolution in the “res” parameter (to force the heuristics to fail)

Then, this should create a new visit for the new “_id” and “res” values.


#7

Thanks for the response. Can you elaborate slightly on the “res” parameter? The content of _id in a typical cookie looks like the following:

e5d7de06246fd732.1325894417.2.1326129037.1325894417.

The “idvisitor” parameter is clearly the first 16 characters, but I am having trouble locating the “res” parameter. Is there a particular substring of the above that represents this parameter?

Thanks!
Jack


#8

bump


#9

After further investigating the API, I now understand how to force heuristics to fail by setting a false value for the user’s screen resolution. This approach is fine and well understood, but i’ve noticed that none of the visit attributes like screen resolution, plugin status, etc. are set when using the API vs. using the JS method. Since I’d rather not spend too many cycles on developing a JS function that can gather and set this information in a way that is accessible to PHP, I am wondering if anyone has any suggestions on doing this?

I will create a new thread on this topic, but any suggestions would be most helpful.

Thanks!
Jack