Access Your Website's HTML
You’ll need to be able to edit the HTML of your website. This usually means accessing your site’s template or theme files.
Locate the Head Section
Find the
<head> section in your HTML. This is usually near the top of the document.Platform-Specific Notes
- Static Site Generators: If you’re using a static site generator like Jekyll, Hugo, or Gatsby, add the Locadapt code to your base template or layout file.
- Single Page Applications (SPAs) and Server-Side Rendering (SSR): If you get hydration errors / the script doesn’t work, you may need to make use of the
data-defer-ssranddefertags on the Locadapt script. For details, see the frontend frameworks guide. - General Advice: You may also want to check out some other special attributes like
data-start-hiddenordata-link-prevent-defaultwhich may be relevant for your specific use case — see the relevant section in the frontend frameworks guide for more details.
Troubleshooting
If you are using a modern frontend framework and have issues with hydration, links not updating, or UI flickering, please see the frontend frameworks guide. There may not be a guide for your specific framework, but the details on e.g.
data-link-prevent-default will be highly relevant.- Verify that you’ve replaced
YOUR_PROJECT_IDwith your actual Locadapt project ID. - Ensure the Locadapt code is placed just before the closing
</head>tag. - Check your browser’s developer console for any JavaScript errors.
- Clear your browser cache and reload the page.