DTM - How do I access a hidden field within a Page Load Rule
1. I created a new Page Load Rule.
2. The conditions on the page are
a. Trigger rule at DOM Ready
b. And only fire when dataelement OrderId is numeric
3. I created a Non-Sequential HTML script in the Javascript / Third Party tags section –
4. I have two variables I want to alter on the page
a. fb_param.value = %SubTotal%; ==== This works fine as this is a javascript variable on the page.
b. fb_param.currency = 'USD'; === This does not work as you can see it is hardcoded as USD but I want it to be dynamic.
So here is the question:
For fb_param.currency = 'USD'; I want the ‘USD’ to be dynamic on the page based on an asp:hiddenfield on the source. Everything I try to access this hidden field variable doesn’t seem to work the way I think it should.
<input type='hidden' name='satlCurrencyType' id='satlCurrencyType' value='USD' />
I have created a dataElement for it called CurrencyType
I have tried to access the variable with jQuery ::: $(“#satlCurrencyType”).val();
I have tried to access the variable the same way as %SubTotal% with %CurrencyType% -- This gives me a javascript error of Reference Error : USD is not defined. So, it finds the dataElement, but it seems to think it is a reference to something else?
I have tried to access the variable as _satellite.getVar('CurrencyType')
I see the object in the DOM : _satellite.dataElements.CurrencyType.
Plus, many other different ways that I thought should work. But, it always gives me an error of some kind.
I just don’t know the best way to access it in Dynamic Tag Management.
Any thoughts?