How to add code snippet to WordPress

Ville Häkkinen

Last Update 8 months ago

Our recommended method for installing HeadQ is to utilize Google Tag Manager. However, if you are using a WordPress site, you have the option to install the HeadQ snippet using a plugin.

Installing HeadQ code snippet to WordPress with a plugin


For the majority of users, the most straightforward method to incorporate JavaScript into WordPress is by utilizing a WordPress plugin. These plugins streamline the process of adding and managing multiple JavaScript snippets efficiently.


To ensure proper functionality, it is essential to install HeadQ's code snippet on every page. For optimal results, we recommend installing the script in the page footer.

WPCode


WPCode, formerly known as Insert Headers and Footers, is a widely recognized code snippet manager. It remains true to its origins by offering a seamless way to incorporate JavaScript into your website's header or footer. In addition, it provides advanced functionality that enables the conditional loading of JavaScript, allowing it to be selectively displayed based on specific content or user criteria.


To begin using WPCode, simply install and activate the free plugin from WordPress.org. Then, navigate to Code Snippets and click on "Add New" to create your first JavaScript snippet.

To include HeadQ snippet, simply hover over the option labeled "Add Your Custom Code (New Snippet)" and click on "Use Snippet." This will allow you to add your own custom code effortlessly.

Steps to create the the Snippet

  1. Name the snippet with a clear name eg. HeadQ Tag
  2. Select the code type as "JavaScript Snippet"
  3. Activate the snippet with the toggle
  4. Press "Save Snippet"


Notice! Please be aware that WPCode will automatically include the necessary opening and closing <script> tags, eliminating the need for you to manually include them in the code.

And that's all. 

Where I can find the HeadQ Code snippet?

You can access HeadQ code snippet through the admin, by clicking the ⚙️ Settings icon from the navigation and then selecting "Installation" from the left hand side navigation

Was this article helpful?

0 out of 0 liked this article

Still need help? Message Us