@tipmaster opened this Issue on February 7th 2017

I am trying to figure out how I can set the custom dimension field only for a landing page and not override it on subsequent requests; is this possible to do with javascript? Can I check if the value is set conditionally in JS?

@tsteur commented on February 7th 2017 Member

and not override it on subsequent requests

Maybe custom dimensions in scope visit help?

@tipmaster commented on February 7th 2017

We are using custom dimensions with the scope "visit".

However, from the documentation:

Custom Dimensions in scope “Visit” can be sent along any tracking request and are stored in the visit of a specific visitor. If you set different values for a given dimension during the lifetime of a visit, the last value set will be used. A typical example could be any device information or the version of the app the visitor is using.

So our question is how can we use javascript to ensure the value is only set once when the visit starts?

@tsteur commented on February 7th 2017 Member

Got it. You would probably need to set a cookie or something once you set the custom dimension the first time and then make sure it won't be overwritten anymore. However, this may be bit tricky since you won't know when it is a new visit. Eg visitor might visit website and you set custom dimension and cookie. Visitor comes back 40 minutes later => Piwik creates new visit, you would need to set the custom dimension again but the cookie you set would likely prevent this since you cannot know when Piwik creates a new visit.

To solve this, a custom Piwik plugin would be likely needed.

@tipmaster commented on February 7th 2017

Thank you.

To confirm there is no way for me to use the Javascript SDK to either

  • check if a custom dimension value has been set for the existing visit already
  • query if this is an ongoing or new visit

or is there?

@tsteur commented on February 7th 2017 Member


Powered by GitHub Issue Mirror