How to dynamically track the the values of form fields? - google-tag-manager

I want to track the field values after submitting a form in gtm. I tried creating dataLayer variable, like
"gtm.element.3.value". But here '3' which is the index value of an input field is static. I want it dynamic so that I don't have to create multiple variables. Do we have to create multiple dataLayer variables of each index value, like gtm.element.0.value, gtm.element.1.value, gtm.element.2.value, etc. ?
Basically I want to make this process dynamic instead of adding the index value statically. Is it possible in GTM?

That completely depends on the format in which your form values are pushed to the dataLayer. Normally, we would ask front-end to push meaningfully named values to the DL to then use in GTM.
From where you're at, you can just make one custom JS variable and parse your elements as you wish, adding the dynamicity you require. In production, however, it's not a good practice to hack things like that. If they add or remove a field in your form, the indexes will shift and your data will suddenly change without notice. This can easily lead to wrong conclusions on the data consumption side.

Related

Is possible to pull a variable from an event in google tag manager

does anyone know if it is possible to pull a variable from an event?
For example, we have 2 different events:
user_type_id
customer_type_id
they both have a DL called customer_type, which pulls different information, the user_type_id pulls if a customer is Platinum, while the customer_type_id pulls if it is a Returning customer, however when using customer_type as the variable in GTM, it sometimes pull Platinum and other times it pulls Returning, is there a way i can setup a variable in GTM so that it pulls customer_type FROM the customer_type_id only?
Any help will be appreciated! :)
enter image description here
enter image description here
The dataLayer is built up of key-value pairs. The key is unique, and if there are multiple calls setting it, you are always replacing the value of the same key.
In your example, there is a key customer_type that is being set in two different scenarios. They are both referring to the same key.
You will need to ensure your key names are unique. I would suggest:
customer_tier: platinum, gold, silver, etc.
customer_type: NEW, RETURNING

Symfony Form multiple range field

I need to make a search form where I need a range slider so a user could choose price_from and price_to. Something like this
What is the best way to implement it?
The only I have found is range type field
It is pretty close to what I need, but it has only one value while I need two values (price_from and price_to)
You are are correct to assume that you need two values (min and max). When I encountered a similar problem, I created two hidden fields for the same purpose.
To fill those hidden fields with values, I used a JS library that rendered the widget and stored the user's input in the hidden form fields:
https://refreshless.com/nouislider/

Google Tag Manager LookUp of LookUps Output Values

I have grouped four sets of landing pages into four corresponding LookUp Table variables, using {{page path}} as the input variable. I've applied an output value for each landing page within each of these groupings.
I group the above variables into another LookUp Table variable (basically a LookUp of LookUps), and use this in an all-pages pageview tag to populate a Google Universal Content Grouping.
My question is whether I need to apply an output value to each input in the LookUp of LookUps?
Asked differently -- since output values are applied to each input in the four landing page lookups, will these pass through to the lookup of lookups, or do I need to apply output values there, too?
In short, the approach above cannot work. It requires GTM variable values to change (as values go from the set of lookups to the 'lookup of lookups'), but they're not meant to chance. A variable is meant to either represent a value, or not.
I wound up inserting dataLayer variables into the landing page code to apply the needed page-by-page designations.

Is it possible to filter the list of fields when outputting a Full Dataset?

I have a DataTable that I'm passing to a FlexCel report. It contains a variable number of columns, so I'm using the Full Dataset feature (e.g. <#table_name.*>).
However, only a subset of the fields are dynamically generated (I have a variable number of attachments). The column name for each attachment field starts with a common word (e.g. "Attachment0", "Attachment1", etc).
What I would like to do is output the known finite set of fields and then the variable number of attachments. It would be nice if I could write something like <#table_name.Attachment*> (and <#table_name.Attachment**>). Is there any way in FlexCel Reports I can achieve the same result?
A side benefit to such a solution means that I could keep the formatting for the known/finite set of fields.
Update
I added place holder columns to the document, each with a <#delete column> tag, so that the un-wanted columns/data are removed.
Although this works, it's not ideal. For example, if I want to see how the columns fit in the page width (in print preview), then I need to hide the columns. Then I have to remember to un-hide them again, so other developers can see/understand my handy work.
It would be much more straight forward if I could filter the fields before they're output to the document.
I realised there's an alternate way around this problem. I broke up the data into two sets of data - <#table_name.*> and <#table_name_attachments.*>.
The fixed set of fields are in the first table and the variable set of fields is in the second table (all the "Attachment*" fields). When the report is run, I place them next to each other (in the same order) in the same worksheet. This means I have two table ranges - "_table_name_" and "_table_name_attachments_" on the one sheet.
Now I'm able to run my print preview without hiding/re-showing the columns-to-be-deleted. I've also eliminated human error - it was all to easy to accidentally set the wrong number of padded/delete columns.

Count of the icon tab filter

I would really like to understand how to use the "count" property of the IconTabFilter for SAPUI5 to dynamically show the count of the result set of a table.
I have the following code -
<IconTabFilter
count="{DataSet/$count}">
<Table items="{DataSet}">
But the count is not filled automatically.
I am using an oData model that is bound on the view level. I do not want to make another backend request just for the counts. What am I doing wrong here? Is there a different mechanism that can be used?
I also tried using the updateFinished event on the table to then get the count and set it via JS but the event is triggered only on DOM placement of the table. In my case the table is hidden behind the IconTab and is not placed into the DOM till the first time the user clicks the tab so its useless.
Really would appreciate some insight into how to use this!
Thanks!
Okay, so what I did was I bound my information to a local model and did an oData $expand query to fetch the entire pages information in one call.
This worked out for me because I had several sets of data to be fetched. Before they were bound individually to tables, now they are all in one query.
In the .done() method of the call I just used the setCount method of the IconTabFilter to set the count as per the return data set.

Resources