---
title: UTM Fields not captured
description: Q. UTM fields are not captured as ProspectId is passed twice because of custom implementation A. The following updated script can be used by the tenant instead for the issue of 2 prospectId being passed in the form submission.  ...
url: "https://supportb.kinsta.cloud/docs/utm-field/"
updated: "2023-08-08"
category: "FAQ: Email Campaign"
---

# UTM Fields not captured

Q. UTM fields are not captured as ProspectId is passed twice because of custom implementation*A. The following updated script can be used by the tenant instead for the issue of 2 prospectId being passed in the form submission.*

*<script>*

*    **document.addEventListener("DOMContentLoaded", () => {*

*        **try {*

*            **//Change the formId according to DOM*

*            **var** **LsqForm** = **document**.**getElementById**(**'frmrlp-block-41'**);*

*      *

*            **LsqForm**.**addEventListener**(**'submit'**, () **=>** {*

*                **var** **nameEQ** = **"ORG59130="**;*

*                **var** **LsqProspectId** = **''**;*

*      *

*                **if** (**MXCProspectId**) {*

*                    **LsqProspectId** = **MXCProspectId**;*

*                **}*

*                **else** {*

*                    **var** **documentCookiesArray** = **document**.**cookie**.**split**(**';'**);*

*                    **for** (**var** **i** = **0**; **i** <** documentCookiesArray**.**length**; **i**++) {*

*                        **var** **documentCookiesArrayItem** =** documentCookiesArray**\[**i**\];*

*                        **while** (**documentCookiesArrayItem**.**charAt**(**0**) == **'** **'**) {*

*                            **documentCookiesArrayItem** =** documentCookiesArrayItem**.**substring**(**1**,** documentCookiesArrayItem**.**length**);*

*                        **}*

*      *

*                        **if** (**documentCookiesArrayItem**.**indexOf**(**nameEQ**) == **0**) {*

*                            **LsqProspectId** =** documentCookiesArrayItem**.**substring**(**nameEQ**.**length**,** documentCookiesArrayItem**.**length**);*

*                            **break**;*

*                **        **}*

*                    **}*

*                **}**   *

*                **var** **prospectElement** = **document**.**querySelectorAll**(**'\[name="MXHClientProspectId"\]'**);*

*                **for** (**var** **i**=**0**; **i** <** prospectElement**.**length**; **i**++) {*

*                    **prospectElement**\[**i**\].**remove**();*

*                **}*

*              *

*                **var** **hiddenElement** = **document**.**createElement**(**'input'**);*

*                **hiddenElement**.**setAttribute**(**'type'**, **'hidden'**);*

*                **hiddenElement**.**setAttribute**(**'name'**, **'MXHClientProspectId'**);*

*                **hiddenElement**.**setAttribute**(**'value'**, **LsqProspectId**);*

*      *

*                **LsqForm**.**append**(**hiddenElement**);**   *

*            **})**       *

*        **} **catch** (**ex**) {*

*            **console**.**log**(**ex**);*

*        **}**   *

*    **});*

*</**script**>*
