markp
Forum Replies Created
-
Hi,
Thanks for all your help on this I’ve got it working now.. I think there was something wrong with my placements of ” and ‘ in the code, I’ve changed it a little and seems to be good.
Code I’m using now is;
<script> document.querySelector("input[name='text-1']").value = '{{set_fieldWithData}}'; </script>
Seems to be working good and I can see them in submissions. Thanks again for all the help.
Mark
- This reply was modified 1 year, 7 months ago by markp.
Still no luck..
This is the code in GTM I’m using;
<script> (function() { var el = document.getElementById('text-1'); if (el) { el.value = '{{cookie - set from gclid}}'; } })(); </script>
I’ve also tried it with with one of the other displayed fields, and using a static value;
<script> (function() { var el = document.getElementById('name-1'); if (el) { el.value = "test text"; } })(); </script>
But neither are working.
Thanks,
Mark
Thanks again! All making sense so far and I’ve hidden that. Now the data isn’t inserting into the field when I test it.
I’ve added a screnshot here, I guess it’s the first ID I should be using id=”text-1″ ?
https://paste.pics/883495b90e3ffe41900065df1a9932f4
Mark
Hi Adam,
Great thanks for the info. Using CSS for the first workaround is slightly above my knowledge, is there any way you could add what CSS I need to use?
For the second part of it ”?you’ll also need to adjust field ID accordingly in your code.” would that be adjusting the ID so that it is static?
Thanks,
Mark
Hi Kris,
That didn’t work, I think because we need it as a custom value as passing in via a variable.
If you go to https://www.lazenby.co.uk/?gclid=monday-7th as an example, you can place anything as the query parameter, then head to the contact page and you can see in dev tools that hidden-1 field is being populated.
When I submit it, I can see it in the network traffic but it just doesn’t appear in the form submissions.
thanks,
mark
ACtually sorry I possibly misread your reply. I’ll try changing to query parameter now and try that. Does that still stand for passing in via a variable?
Testing it now..
Hi Kris,
Thanks for the quick reply. We are actually passing the parameter in via a variable in GTM rather than from the URL.
The reason being is that mostly the users land on a different page than the form, so the query parameter in the URL is lost between pages. We are storing it as a variable instead and passing it into the form.
I can see that this stage is working correctly, the value is passed to the form from the variable, and appears to be sent with the form – so all this is correct – it’s just not appearing in WP/forminator.
THanks,
Mark
Hi Zafer,
Great thanks for the reply.. I’ve actually managed to sort this now using google tag manager: I’ve created a variable to store the GLCID from the URL, set a first party cookie with the value of that variable and then used a script (found online) to insert that variable into an empty hidden field into the form.. Can provide more details if needed but it seems to work well.
Would be interested to know if the support team have a different method too..
THanks,
Mark