How to set a custom dimension?

Hello, first, happy new year ! :slight_smile:
I’m trying to set a custom dimension but i’m not really sure how to do it.
I don’t really understand the tutorial.
I would like to record a specific part of an url.
My urls can be like this:
https://www.mywebsite.com/search/index.php?a=images&q=query
or
https://www.mywebsite.com/search/index.php?a=videos&q=query
I would like to record if the query is made from “images” or “videos”.
Can i do that with a custom dimension ?
Thanks.
Regards.

For this you need to write a little bit of javascript that reads the URL query parameter and then in your Piwik JS code, you call the setCustomDimension function passing it the value of the URL query parameter.