Solution to slow down websites with third-party codes such as Aifanfan and Baidu Business Bridge

WordPress Technology Blog Wp application technology Site Templates FAQ

Third party codes such as Aifanfan, Baidu Business Bridge and other tools slow down the website

Many users will encounter slow website speed when using third-party tools such as online dialogue tools: Aifanfan, Baidu Business Bridge and other codes. The original website loading speed is very fast, but it will be slow after the third-party code is put in. The clear space is Baidu Business Bridge (now renamed Aifanfan), This article will tell you how to solve this type of situation.

First of all, this type of third-party tool will tell you to put it in the head of the website. The head of the website is actually the head of the website, and the page is loaded from top to bottom. In this way, the third-party tool will be preferred to render the website ontology when the website is first loaded. In this way, No matter how well you optimize your website, you can't avoid third-party tools slowing you down.

In particular, the website that uses lazyload slow loading image technology has a great impact. Because it occupies the rendering judgment of lazyload, the image is delayed to load (this technology can be used by all series of WEB theme parks to speed up website access)

Therefore, we can load the code provided by the third party into the bottom footer.

Since third-party tools are all JavaScript, it is a common way to load JavaScript from the bottom.

 

Improved way to load the bottom and delay loading

The following is the code taking Aifanfan (Baidu Business Bridge) as an example:

If you use the theme of the WEB theme park, you can directly add it to the bottom of the third-party code (generally, third-party code will let you fill it in the head)

 Solution to slow down websites with third-party codes such as Aifanfan and Baidu Business Bridge

If your theme does not provide this type of code, you can put the code into footer.php

<? php wp_footer()();?>

Below, because wp_footer() is a mount function of WordPress, it will normally load some scripts of the theme. Let's put third-party code into the final load.

 

Add delay parameters to delay the loading of JavaScript without affecting the loading of website ontology

The code of Aifanfan (Baidu Business Bridge) is usually as follows:

 


<script>var _hmt = _hmt || [];
(function() {
Some codes
</script>

Then we can add the parameter defer: type="text/javascript" defer="defer" in the script tag

The codes are as follows:

<script type="text/javascript" defer="defer">
var _hmt = _hmt || [];
....

In the options, it is as follows:

 Solution to slow down websites with third-party codes such as Aifanfan and Baidu Business Bridge

 

In the code editor:

 

 Solution to slow down websites with third-party codes such as Aifanfan and Baidu Business Bridge

 

In this way, you won't have to worry about the impact of third-party code.

Previous:

Next:

Article comments

Cancel Reply
    Expand more