Create custom variable for media plugin


I want to create the custom variable for media plugin. I seen the document their they have given scope for “visit” or “page”.
setCustomVariable(index, name, value, scope = “page”)

Please let me know how we can set custom variable for media



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.

Custom Dimensions in scope ‘Action’ can be sent along any action (page view, download, event, etc.). A typical example would be for example to track a language along any page view, download or event.
Custom Dimensions - Analytics Platform - Matomo

So I guess as you only want that this dimention is only valid for the specific page view, you’ll probably want to use page.