How to Manually Install a Custom Pixel Script in HTML
Important: Before You Begin
- Have your script ready: Ensure you have the complete custom pixel script provided by the third-party service (e.g., Google, Meta, Dash.fi).
- Back up your files: Before editing any code, always create a backup of your website's HTML files. This allows you to restore your site quickly if an error occurs during the installation.
Step-by-Step Installation Guide
Follow these steps to add the script to your website's code.
1. Identify the HTML File(s) to Edit
You will need to add the script to every page you want to track.
- For a single-page website: You will likely only need to edit the main
index.html
file. - For a multi-page website: You must add the script to each individual HTML file (e.g.,
index.html
,about.html
,contact.html
, etc.).- Note: If your website uses a templating system with a shared header file (often named
header.html
,head.html
, or similar), you may only need to edit that single file to deploy the script across all pages.
- Note: If your website uses a templating system with a shared header file (often named
2. Open the HTML File
Open the relevant HTML file using a text editor (like VS Code, Sublime Text, Notepad++) or your hosting provider's built-in file editor.
3. Locate the <head>
Opening & </head>
Closing Tag
Scroll through the code and find the closing head tag, which looks like this: </head>
. All tracking pixels should be placed within the <head>
section of your HTML.
4. Paste the Pixel Script
Paste your entire custom pixel script on a new line immediately before the closing </head>
tag.
Example:
HTML
... <title>My Awesome Website</title> <link rel="stylesheet" href="css/styles.css"> <script> // Your entire pixel script code goes here. </fscript> </head> <body> ...
5. Save and Upload Your Changes
Save the file after pasting the script. If you are editing the file on your local computer, you must upload the modified file back to your web server (using FTP, SFTP, or your hosting control panel) to make the changes live.
6. Repeat for All Necessary Pages
If your site does not use a shared header file, you must repeat steps 2-5 for every page on which you want the pixel to track activity.
Your custom pixel script is now installed. It may take a few minutes for the changes to be reflected on your live site.