Dynamically add scripts to head

I’m building a landing page generator and I need each page to be tracked with a Facebook Pixel with a unique id. From what I read, I am to put the script in the head. Can I implement the script in the body, or is there a way to insert the script into the head?

You can put your script in your <head> in the root.html.heex template.

If you don’t use live view you can just assign the unique id to the assigns on the conn in your controller and access it in the template or determine the id based on your current path.