Code Snippets

Reading Time:4minutes

Insert code snippets to site header or footer section like Google Analytics code, AdSense Code, Facebook Pixels code, and more.

You no longer need to manually modify theme code such as header.php, and no code snippets are lost when switching or updating themes.

You can enable this module via “WordPress Dashboard -> Plover Kit -> Modules -> Code Snippets

You can manage code snippets by clicking the Settings button.

Add New Code Snippet

Let’s show how to add code snippet to your site with an example of adding Google AdSense auto ads code.

First, Click the Add New Snippet button in the upper right corner of the Code Snippet module settings page.

Although this is a demo, if you did have an AdSense account and are looking for how to add ad code, then you can copy your own ad code via Get and copy the AdSense code.

Then as shown in the image below. Paste your ad code in the code editor on the left, and set the meta information of the code snippet on the right sidebar.

Finally click the save button and you’re done.

Code Snippet Option Details

Now, Let’s dive into what the code snippet options does.

Snippet Name

The name of the snippet, used to differentiate it when managing snippets. I suggest you choose a name that matches the actual function.

Location

Currently there are only Header and Footer options.

The Header option means that your snippet will be output inside the <head></head> tag.

The Footer option means that your snippet will be output before </body> tag.

Priority

Priority used to specify the order in which code snippets are output, the higher the priority the earlier they are output.

Exclude Post Types (Premium)

In the premium plan this code snippet will not be output in excluded post types.

Exclude Authors (Premium)

In the premium plan this code snippet will not be output in posts published by excluded authors.

Exclude Posts/Pages/Products … (Premium)

In the premium plan you can also exclude snippets from individual posts, pages or products.

Enable

You can enable or disable a snippet without removing it with this option.

Code Snippet List

When you navigate to the Code Snippets Module Settings page, if you have created some snippets, you can edit or delete it here.

Code Snippet Block (Premium)

You can use the Plover: Code Snippet block to output pre-created code snippets on anywhere.

Add code snippet block via slash command:

Then select the code snippet you want to output from the list.

Code Snippet Shortcode (Premium)

Another way is to output pre-created code snippets on anywhere via Shortcode.

This method has the same effect as Plover: Code Snippet block, and is more useful in locations where blocks are not supported.

You can find the shortcode for each code snippet in the Code Snippet list.

The code snippet options (position, priority, exclude, etc.) does not work for this.

Supported Features

  • Google Analytics code
  • Google AdSense code
  • Google Tag Manager code/script insertion
  • Google Optimize Code for A/B testing ( Ab Testing )
  • Google search console authentication code to any theme for verification
  • Add Custom CSS, any script, and HTML to your website
  • Add Microsoft clarity tracking code to your website
  • Add Pinterest site verification
  • Facebook Pixels, Facebook Scripts, Facebook og:image Tag
  • Google Conversion Pixels
  • Twitter
  • Heatmaps from Crazy Egg, notification bars Hello Bar, etc.
  • It can accept ANY code snippet (HTML / JavaScript / CSS) from any service

Leave a Reply

Your email address will not be published. Required fields are marked *