Introduction
The Head Codes feature in Newsifier allows you to integrate custom code within the head section of your webpage. This is important for adding scripts or metadata that need to load before the rest of the page is displayed.
What are Head Codes?
Head codes refer to any code placed between the <head> tags of a webpage. These codes are loaded before any visual content on the page, ensuring that important scripts, such as those from ad providers or verification services, are in place before the page is fully rendered.
Common Uses for Head Codes
Ad Provider Codes: Many ad agencies require you to insert their scripts within the head section so that ads load before the rest of the content.
Search Console Verification: You can use a meta tag within the head section to verify your site with tools like Google Search Console.
Custom CSS: Sometimes, head codes are used to apply custom CSS styling before the rest of the page loads.
Predefined Head Codes in Newsifier
For most customers, Newsifier sets up predefined head code positions for different types of pages, such as:
HEAD_HOMEPAGE: For the homepage.
HEAD_ARTICLE: For article pages.
HEAD_PAGE: For homepage variations or other specific pages.
HEAD_TAG: For tag pages.
These positions are predefined but delivered empty, meaning it's up to the customer to add any necessary codes, such as those provided by ad agencies or third-party services, if required.
Adding or Editing Head Codes
Go to the Head Codes section in the admin panel.
Select a predefined head code position (e.g., HEAD_ARTICLE for article pages).
You will see a name and slug for the head code—these are predefined and cannot be changed.
On the right side, you’ll find the option to publish the head code (Yes or No).
Content Section: This is where you can add your custom head code, such as ad provider scripts or CSS.
Note: While there are options for position and min-height, these settings are not typically used for head codes.
When to Use Custom Head Codes
Most users won’t need to insert custom head codes unless requested by an ad provider or a third-party verification service. In these cases, follow the steps above to insert the code where needed.
Note: This feature is only available in Newsifier V1. If you are using Newsifier V2, you will need to add the required Head Codes through Buildifier.