we'd like to save the UTM tracking fields in the appointment booking forms so that they are available in Salesforce. We use HandL UTM grabber and according to their docs, it should work if you add these custom fields:
The fields do get added, but they remain empty. I think internally they are supposed to call the shortcodes to insert the variables or something. Is there any "Amelia way" to insert a shortcode for a custom field, or do I have to do some Javascript hacking? :)
We just got the feedback from our colleagues and they have told us that you'll need to add a custom field (in this example, it is a text area with the label 'UTM tags') and connect it with the services you want:
Then, add this script to a page where the booking form is:
<script> window.ameliaActions = { ViewContent: function (success = null, error = null, data) { console.log('customValidation HOOK') console.log('------------') console.log(data) let myInterval = setInterval(() => { let infoStep = document.getElementsByClassName('am-fs__info'); if (infoStep.length) { clearInterval(myInterval) var elFormItems = document.querySelectorAll('.el-form-item'); elFormItems.forEach(function (elFormItem) { var labelElement = elFormItem.querySelector('label span'); if (labelElement && labelElement.innerText.trim() === 'UTM tags') { elFormItem.style.display = 'none'; } });
function getUTMParameters(url) { let result = {}; // Use a regex to find and extract UTM parameters from the URL let utmRegex = /[?&](utm_[^=]+)=([^&]*)/g; let match; while ((match = utmRegex.exec(url)) !== null) { result[match[1]] = decodeURIComponent(match[2]); } return result; } let currentURL = window.location.href; let utmParameters = getUTMParameters(currentURL); data.booking.customFields[12].value = JSON.stringify(utmParameters) }
},1000) }, } </script>
Here, we use JavaScript to hide that custom field (identified by its label 'UTM tags') and then bind UTM parameters to it.
In this example, the custom field is assigned the number '12'. You'll need to check the number associated with your custom field, which can be found in the console.log(data) output under booking.customFields.
UTM tags will be saved under this custom field, and you can check them on the Appointments page.
thank you very much for providing the code. In this case the also very supportive developer of HandL beat you to it and improved the functionality in his plugin, so that values get inserted more robustly :) It will probably be included in the his next release or the one after.
Hi,
we'd like to save the UTM tracking fields in the appointment booking forms so that they are available in Salesforce. We use HandL UTM grabber and according to their docs, it should work if you add these custom fields:
https://docs.utmgrabber.com/books/amelia-integration/page/track-utms-in-amelia-booking
The fields do get added, but they remain empty. I think internally they are supposed to call the shortcodes to insert the variables or something. Is there any "Amelia way" to insert a shortcode for a custom field, or do I have to do some Javascript hacking? :)
Best,
Holger
Hello there,
We have forwarded your ticket to our level 2 agents and as soon as we get some feedback from them we will contact you.
Kind Regards,
Marko Davidovic
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hello again,
We just got the feedback from our colleagues and they have told us that you'll need to add a custom field (in this example, it is a text area with the label 'UTM tags') and connect it with the services you want:
Then, add this script to a page where the booking form is:
Here, we use JavaScript to hide that custom field (identified by its label 'UTM tags') and then bind UTM parameters to it.
In this example, the custom field is assigned the number '12'. You'll need to check the number associated with your custom field, which can be found in the console.log(data) output under booking.customFields.
UTM tags will be saved under this custom field, and you can check them on the Appointments page.
Kind Regards,
Marko Davidovic
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hallo Marko,
thank you very much for providing the code. In this case the also very supportive developer of HandL beat you to it and improved the functionality in his plugin, so that values get inserted more robustly :) It will probably be included in the his next release or the one after.
can be closed!
Best,
Holger
Thank you for letting us know, Holger!
Marko is out of the office so I'll close this ticket.
Please feel free to reach out to us if you have any further questions or concerns!
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables