Insert code lead

I have a company that wants to embed some code to capture a lead via a form. How should I go about this? I have two IDs and an API key.

I thought about adding a .php file to the project, but that isn’t possible. I considered using JavaScript, but the API key would be visible in the browser, which isn’t secure. Do you have any best practices, please? It’s urgent; I need to hand in the project today. Obviously, they’ve given me the documentation for the attribute names but not the process. Either I sort it out myself or they do it with access to the host, which I’m not too keen on, given that I push updates to the site based on changes; the lead code shouldn’t be overwritten.