---
title: "Adding custom code in Magento 2 <head> HTML tag"
url: "https://magecomp.com/blog/add-custom-code-in-magento-2-head-html-tag/"
date: "2021-03-30T13:10:12+00:00"
modified: "2024-11-26T11:03:12+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "Magento Tutorials"
word_count: 228
reading_time: "2 min read"
summary: "Hello Magento Friends,"
description: "Meta data, store notice and instructions are added in the tag of HTML pages in Magento 2. Learn Adding custom code in Magento 2 HTML tag"
keywords: "Magento Tutorials"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to get Magento 2 all stores programmatically (Retrieve a list of all stores)"
    url: "https://magecomp.com/blog/get-magento-2-all-stores-programmatically/"
  - title: "A Step-by-Step Guide to Installing Cloudflare CDN for Magento 2"
    url: "https://magecomp.com/blog/install-cloudflare-cdn-magento-2/"
  - title: "How to Create Simple Products in Magento 2?"
    url: "https://magecomp.com/blog/create-simple-products-magento-2/"
---

# Adding custom code in Magento 2 HTML tag

_Published: March 30, 2021_  
_Author: Dhiren Vasoya_  

![How-to-Add-Custom-Code-in-Magento-2-head-HTML-tag](https://magecomp.com/blog/wp-content/uploads/2021/03/How-to-Add-Custom-Code-in-Magento-2-head-HTML-tag-png.webp)

**Hello Magento Friends,**

Today’s Tutorial Blog for Magento 2 will justify, Adding custom code in Magento 2 <head> HTML tag.
Head tag is used to link any external resources, add metadata or javascript code to your website. In Magento 2 you can configure the <head> tag for each store view. Instructions for search engine and store demo notice are added in the head section. Any javascript code which is to be added before the <body> tag must be included here.
Let’s learn Adding custom code in Magento 2 <head> HTML tag.
**Steps to Add custom code in Magento 2 <head> HTML tag:**

**Step 1:** Go to the Magento Admin Panel and navigate to Content > Design > Configuration.
**Step 2:** Select the store view to change the head tag or select global to change the head tag for every store view.
**Step 3:** Enlarge the **HTML Head** section. Add your custom code to the **Scripts and Style Sheets** field.
![Add-Code-in-Head-Tag](https://magecomp.com/blog/wp-content/uploads/2021/03/Add-Code-in-Head-Tag_11zon.webp)

**Step 4:** At last, **Save Configuration**. Go to Cache Management and **Flush Magento Cache**.
## Final Words:
Hence, this way you can add custom code in Magento 2 <head> HTML tag. Catch up with our [**certified Magento Developers**](https://magecomp.com/hire-magento-developer.html) to customize your store. In case of any casualties, do let me know via the comment section. Share the tutorial with your friends and stay connected!
**Happy Reading!**


---

_View the original post at: [https://magecomp.com/blog/add-custom-code-in-magento-2-head-html-tag/](https://magecomp.com/blog/add-custom-code-in-magento-2-head-html-tag/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-08-31 11:18:38 UTC_  
