Best Practices regarding clearing of variable persistence in PP TM

Hi @loldenburg,

When it comes to tag templates - there is no built-in switch to remove a value from the JavaScript Tracking Client after it has been sent with a specific event. It will be deleted upon a page reload or if you call deleteCustomDimension.

You can call deleteCustomDimension to delete a value of a specific custom dimension (or do a simple loop to delete multiple values).

Probably the most reliable way if you want to achieve this is doing something like this (yep, custom HTML tag):

var _paq = _paq || [];
_paq.push(["setCustomDimensionValue", 3, "value"]);
_paq.push(["trackEvent", "video", "video-paused", "intro.mp4", 15.2]);
_paq.push(["deleteCustomDimension", 3]);

When it comes to custom events (and some other events that support dimensions (object)) you can add an object of custom dimensions that will “attach” them only to this specific tracking request (it basically skips setting the value in JSTC)

API — Piwik PRO Analytics Suite 18.7 documentation

There’s also the method that uses tag priority.