I’ve just added custom code which is supposed to show up before the ending body tag:

It seems to be adding this code to the header. When I view the source of one of the pages to which it should be applied, it shows up on line 55 whereas the tag is on line 4744 and on line 7286. The custom code has text in it which is identifiably unique - it is found in one place only, and that is in the header.
Any ideas?
https://support.wix.com/en/article/embedding-custom-code-to-your-site
https://support.wix.com/en/article/about-tracking-tools-analytics
This is not a code related issue and therefore you should be going through Wix Support for more help with this
https://support.wix.com/en/article/contacting-wix-customer-care-for-support
Also, please note that with any custom code used, that Wix will not provide support.
Wix does not provide support for technical difficulties associated with third-party code snippets. If you are experiencing an issue with your code snippet, please contact the provider directly.