Home Astra Theme Tutorial Standard Post

Standard Post

Adding Google Analytics Code to the Astra Theme Using Custom Layout Functionality

Astra is a highly customizable WordPress theme. You can use Astra's Custom Layout feature to add different code and content to your website without modifying theme files or installing additional plugins. The theme's built-in features can achieve this. Ordinary WordPress themes add Google...

Updated on July 22, 2022 About 2 minutes read
使用自定义布局功能为Astra主题添加Google统计代码

Astra is a highly customizable WordPress theme. You can use Astra's Custom Layout feature to add different code and content to your website without modifying theme files or installing additional plugins. The theme's built-in features can achieve this.

OrdinaryWordPress theme method for adding Google AnalyticsOr other methods of adding tracking codes involve editing theme templates or installing additional plugins.

If you are usingAstra Theme, then you can use the Custom Layout feature to add it.

The specific steps are as follows:

1. In the Astra Pro settings, enable the Custom Layouts feature, as shown in the image below:

Astra自定义布局功能

2. In the left-hand theme options, find Custom, enter it, create a new project, and click the code editor to edit.

Astra自定义布局

3. Give it a name for identification, e.g., Google Analytics Code. Then, paste the Google Analytics code you created into the content area below.

Astra自定义布局

4. In the Custom Layout settings below, select Hooks for Layout, choose wp_footer for Action, and select Entire Website for Display On.

Astra自定义布局

After publishing, your website's source code will contain the Google Analytics code you just added. Isn't it simple?

With this method, you don't have to worry about messing up your theme code, nor about losing content after theme updates, because everything is stored in the database.

If you wantBuilding Your Own Websiteand also hope to achieve many custom features and a beautiful appearance, then Naiba recommends you tryAstrathis theme.

A method more suitable for beginners:

Quickly Submit Your WordPress Website to Google and Add Google Analytics Code

5/5 - (1 vote)
Previous Never Do This with Text on Your Website's Slideshow Continue reading content around the same timeline. Next Foreign Trade Independent Website Uses LayerSlider Slideshow Plugin to Capture User Attention and Improve Conversion Rate View the next related tutorial or experience.

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: