Saving data with custom plugin for visitor location

Hello,

I have written 2 custom plugins that integrate location information and visitor photos to the live feeds using the hook “Live.getExtraVisitorDetails” for an internal Piwik server. This all works perfectly but it doesn’t seem like the Live.* hooks are saved into the database. If we run a report the information is not there, but it does display on the live widgets.

I looked at the docs but couldn’t find a similar hook that wasn’t for Live data. I have also come across dimensions but that seems like it’s more for custom properties and not for updating existing ones, correct me if I’m wrong?

The fields we update on the visitor data are:

  1. visitorAvatar
  2. languageCode
  3. latitude
  4. longitude
  5. city

Is there a way to update this information for visitors that would be saved/archived to the database? Thanks!

1 Like

Hello,

Is there a way to update this information for visitors that would be saved/archived to the database? Thanks!

When you need to persist data for a User (Visitor) or an Action (eg. pageview), we recommend to use Custom Dimensions which we implemented in the last year and is a great solution :+1: https://piwik.org/docs/custom-dimensions/

Regarding the relationship with Live.getExtraVisitorDetails - when you hook, you can read the custom dimension value from the DB and preset these values eg. visitorAvatar

Regarding updating existing fields eg. latitude/longitude/city, this could be done in your custom plugin (these metrics are VisitDimension: http://developer.piwik.org/2.x/api-reference/Piwik/Plugin/Dimension/VisitDimension objects )

1 Like