How to optimize plugin settings
Ad Inserter is built for speed. In normal cases it should not significantly increase page loading time. Of course, if you are using many blocks this may slightly increase processing time, but still it should not cause any problem. In most cases the time needed to insert blocks is in the range of few 10 milliseconds.
Usually the cause for long page loading time is slow loading and processing of external files needed by the ad codes you have inserted – check how ads are displayed. You can use debugging functions or individually disable (pause) insertion for each block to see which ads cause trouble. You can also check Network tab in Web inspector in the browser to see which files are slowing down the page.
Please note that Ad Inserter does not do any redirects, it only inserts ad codes as configured. If you see any report mentioning redirects you need to first check where they are – if they are on other domains you don’t control, then there is nothing you can do (nobody except ad network can change this). Ad networks usually use many page redirects to load the right ads for your website.
Processing of your PHP code used in some code blocks may also increase page loading time.
However, it is very easy to determine how much time Ad Inserter uses to insert the code. Log in as admin and go to a page where you would like to check Ad Inserter processing time. Enable debugging function Log Processing and check page source code at the bottom. Among other debugging data you should see the following lines:
PLUGIN CODE PROCESSING: 81.55 ms USER CODE PROCESSING: 210.08 ms TOTAL PROCESSING TIME: 291.63 ms
PLUGIN CODE PROCESSING time is the time used by the plugin to insert code blocks – this is the time that Ad Inserter itself actually adds to the page loading time (when the page is not cached).
USER CODE PROCESSING time is the time used to process your PHP code in Ad Inserter code blocks. If you are not using PHP code then this time should be 0.
TOTAL PROCESSING TIME is the total time used by the Ad Inserter plugin to process your PHP code and to insert the all the codes into the page.
Slower processing is mainly due to complex settings for paragraph insertion in combination with PHP functions for string processing. This might become noticeable if you are using Multibyte functions for paragraph counting.
However, slower page load may not be only because of plugin processing, the code you are inserting may also increase page load time. Check processing log of Ad Inserter as described above and use browser debugging functions to determine the nature of the problem – look also for render-blocking scripts.
Please note that when you disable Ad Inserter you also disable insertion of all codes and blocks you have configured. Therefore, if your issues go away when you disable the plugin THIS DOES NOT INDICATE any issue with the plugin! You need to try to disable individual codes to see which one is causing trouble.
Use back-end debugging to disable insertion of various codes to see which code is slowing your page.
Check how much time Ad Inserter spent on processing the code. Enable debugging function Log Processing and check page source code at the bottom. Among other debugging data you should see plugin processing time (as described above).
Use browser debugging functions to determine the nature of the problem.
Check for render-blocking scripts – google for it, this is beyond the scope of plugin documentation.
Multibyte PHP functions for paragraph counting are much slower than standard ones. Use them only when insertion between paragraphs does not work properly on non-english pages.
If you are inserting the same ad with the same paragraph settings (except paragraph number) more than once you should combine them into one block. You can list all paragraph numbers for one code block. This will speed up processing as paragraphs will be counted only once.
Each plugin is slowing down the speed of your website. Try to reduce the number of installed plugins. If you are using a separate plugin for the following function you can remove the plugin and use Ad Inserter instead:
- To create or edit ads.txt file
- To insert header and footer code
- To insert AMP ads on AMP pages
- To insert PHP code
- For sticky (fixed) widgets – in some cases you may still need a dedicated plugin
- For widget logic to restrict widgets – for each block you can define conditions
- To detect ad blocking and display message
- To insert tracking codes including Google Analytics
- To insert ads at custom action hooks
Optimize page code and scripts on the page
However, some caching or optimizing plugins (like Autoptimize) may move it to the page footer or mark it with
jQuery is not defined.