Tutorials · 3 min read

A dog and a cat

Dynamic metadata: use variables in the metadata tag to segment your audience

You can use variables in the video metadata tag to segment your audience and track usage-based data on different audience metrics. In this post, we segment a video based on whether the viewer is a cat or a dog lover.

Doug Sillars

October 13, 2020

Organization of your videos helps you deliver the correct videos to the correct page.

If you look closely in our API, we also offer a metadata tag with key:value pairs to be used as an additional organizational tool. In many ways, metadata and tags are functionally similar.

However, we also support the concept of dynamic metadata. Dynamic metadata is not directly related to the video - but is more related to how the video has been consumed. The values of dynamic metadata are variable and are added during playback, allowing you to further segment your audience analytics.


By default the api.video analytics engine can report both video stats and session specific data. There is a tutorial describing how to use the analytics endpoints.

Stats: Each video can be parsed to quantify views, time/date of view, browser and location, and more. You can read more on the Video Analytics endpoint.
[Session]: Each video session has a unique ID. For each session, several events are recorded in the player. Currently, this list is: ready, play, pause, resume, seek.backward, seek.forward, end.

By default, you gain a lot of insight as to how your audience views and consumes your video. We can use dynamic metadata to segment your audiences for deeper insights.

Segmenting your video audience

Imagine that you have two segments of users on your website: dog lovers and cat lovers. You want to know which videos are more appreciated by each segment of your population.

For these videos you can add a dynamic metadata key:value where the value changes depending on the viewer. For example:

{"key" : "dogcat", "value", "__dogcat__"}

The double underscore before and after the value tells the API that this is a dynamic attribute, and the value of the dogcat attribute will be measured on each session of the video.

Using the segmentation

Now that you have added the dog/cat segmentation to the video, each view of the video can be segmented. To do this, we append a url parameter.

For example, dog lovers would receive this video:



The video is my dog Malla, who is named after Chewbacca’s wife (from the infamous Star Wars Holiday Special). You have to admit, she sounds a bit like a Wookie.

These urls can be built dynamically based on user profiles on the website. When the video is watched, this metadata is added to the analytics session. Each video play will mark the viewer as either a dog lover or a cat lover.

Now, since the viewer's cat/dog preference is added to the video statistics, you can learn how your two audiences interact with each video on your site, and which videos are preferred by dog or cat people.

Using the video stats endpoint, I have found that my team is:

  • 50% dog
  • 37.5% cat

and, well:

  • 12.5% "know-it-all":
						"key": "dogcat",
						"value": "dog"

						"key": "dogcat",
						"value": "dog"

						"key": "dogcat",
						"value": "cat"

						"key": "dogcat",
						"value": "cat"

						"key": "dogcat",
						"value": "dog"

						"key": "dogcat",
						"value": "cat"

						"key": "dogcat",
						"value": "dog"

If you have unique IDs for each user, you could also track video watching per user (how often they view each video, or if they are watching the entire video). This could be very useful for online training compliance, classes, or even to check on credential sharing. The possibilities are endless!


Using dynamic metadata and url parameters, you can segment your video analytics into different populations, and better understand how your users are using your videos. How are you using dynamic metadata in your app's videos? Leave a note on our community forum. If you don't have an api.video account yet, you can create one in just a few moments by following this link. Happy building!

Try out more than 80 features for free

Access all the features for as long as you need.
No commitment or credit card required

Video API, simplified

Fully customizable API to manage everything video. From encoding to delivery, in minutes.

Built for Speed

The fastest video encoding platform. Serve your users globally with 140+ points of presence. 

Let end-users upload videos

Finally, an API that allows your end-users to upload videos and start live streams in a few clicks.


Volume discounts and usage-based pricing to ensure you don’t exceed your budget.