# Send Meta Data with RUM for APM

**URL:** <https://discuss.elastic.co/t/send-meta-data-with-rum-for-apm/383250>\
**Category:** APM\
**Tags:** rum\
**Created:** [November 5, 2025, 3:28pm UTC](https://discuss.elastic.co/t/send-meta-data-with-rum-for-apm/383250 "2025-11-05T15:28:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![learningelastic](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@learningelastic](https://discuss.elastic.co/u/learningelastic)\
**Post date:** [November 5, 2025, 3:28pm UTC](https://discuss.elastic.co/t/send-meta-data-with-rum-for-apm/383250/1 "2025-11-05T15:28:18Z")

</div>

I am testing out a few of the Agent API in RUM with Elasticsearch APM as shown in this documentation here: [Agent API | APM RUM JavaScript agent](https://www.elastic.co/docs/reference/apm/agents/rum-js/agent-api)

So far I got most things working like getting span information, traces, transactions, user interactions, errors etc…

There’s only one thing left I can’t figure out, and it is how to run the `addLabels`, `setUserContext` and `setCustomContext`. Here’s my code:

```auto
	<!DOCTYPE html>
	<html lang="en">
	  <head>
		<meta charset="utf-8" />
		<title>Meta Data</title>
		<script src="https://unpkg.com/@elastic/apm-rum@5.12.0/dist/bundles/elastic-apm-rum.umd.min.js"></script>
		<script>
	const apm = window.elasticApm.init({
	  serviceName: 'myapp',
	  serverUrl: 'http://192.168.0.21:8200',
	  serviceVersion: '0.90'
	});
	const clickSendMetaData = () => {
	  const msg = document.getElementById('message').value;
	  apm.addLabels({'MyLabel': msg})
	  apm.setUserContext({'id': msg, 'username': msg, 'email': msg + '@' + msg + '.com'})
	  apm.setCustomContext({'MyObject': {'MyCustomContextMessage': msg}})
	  console.log('sent meta data');

	};
		</script>
	  </head>
	  <body>
		<input type="text" id="message" placeHolder="Type A Message For Meta Data" value="" />
		<button id="send_meta_data" name="send_meta_data" onClick="clickSendMetaData();">Send Meta Data</button>
	  </body>
	</html>

```

When I click the `Send Meta Data` button, nothing happens. I look in my browser’s `Network Tab` and no http requests are made. There are no errors in my console, only the message `sent meta data` which shows all the code fired without issues.

Am I missing something from my code?
