DOM element syntax?

Pardon me for a silly question, but I could not find answer in the documentation.

I have a meta element like this:

<meta name="titel" content="RoleName">

and I try to read the value to DOM element. I’ve selected variable type “DOM Element”, Selection method “Element ID” and Element ID titel (without quotation marks), but the variable (even when triggered) returns an empty value. How should I refer to that DOM element on the page (the element actually is in the page headers)? Thx.

I think the thing you are looking for doesn’t exist.
You can choose from a set of Meta Content Variables but the one you are looking for is not available.
Or it is, but your example doesn’t show that.

Well if you have eg. something like this on your page

<meta property="og:title" content="My awesome website" />

You can choose a inbuild variable type of Page Meta Content and the relevant property, name, …

Another way to fetch meta content is by Custom Javascript and crawl through the one you need.

//fetch all elements
document.getElementsByTagName('meta');
metas[0].name // get the first meta and provide the name.

Does this help?

Thanks, I’ll give it a try.

The reason I try to read that variable through a DOM element is that I first tried to read it from a Javascript variable, triggered by DOMready. However, when the trigger fires, the Javascript variable is still empty, and only with a timer trigger (firing at 5 seconds) does the variable have desired value. I’m concerned here that if the use leaves the page within that 5 seconds, I miss the variable data altogether.

But if you create a CustomJavascrip Variabe it should update with every event that happens on your page.

For example:

function () { 
randomNumber = Math.random();
return randomNumber;
; }

Should provide you on Pageview, DOMReady & WindowLoaded always a new value.
So if you can fetch you desired value via something like this it should be available.