Press enter to see results or esc to cancel.

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 a 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.

The plugin can be configured to process dynamic features client-side (in the browser). This significanly reduces the number of requests to the web server. However, some PRO features like internal tracking and geo targeting need to make a request to the web server for each page load. This may introduce additional load to the server and database on websites with very high traffic which may consequently slow down the web server. If you are using internal tracking or geo targeting make sure your web server can handle it.

Some hosting companies sell more disk space, CPU power, RAM and bandwidth on a server than actually exists – this is called overselling. The basic idea of overselling is assuming that majority of the clients are only going to use a fraction of the resources allocated to them, so there is going to be a lot of wasted bandwidth and space. Overselling involves taking a gamble and selling more than the hosting company can handle with the assumption that the unused resources will cover it. This can lead to slower loading times and limited bandwidth, which can negatively impact your website’s performance. In principle there are two possible approaches to address server load:

  • Configure the website (including plugins) to take into account available resurces on the web server (limited by your hosting)
  • Choose hosting plan according to the features you would like to use 

Please note that Ad Inserter does not do any redirects, it only inserts ad codes as configured. If you see any report (for example from GTmetrix) suggesting to minimize redirects you need to first check where the redirects are located (on which page or domain) – if they are on other domains you don’t control, then there is nothing you can do (nobody except ad network can change this). URL redirection is a World Wide Web technique for transferring (redirrecting) a web page to a different URL address. Sometimes it’s necessary for your application to redirect the browser from one URL to another. There are several reasons ad networks or web applications issue redirects:

  • To indicate the new location of a resource that has moved.
  • To track clicks and impressions and log referring pages.
  • To reserve multiple domains, allow for “user-friendly” or “vanity” domains and URLs, and catch misspelled/mistyped URLs.
  • To connect between different parts of a site or application, different country-code top-level domains, different protocols (HTTP to HTTPS), different security policies (e.g. unauthenticated and authenticated pages) etc.
  • To add a trailing slash to URL directory names to make their contents accessible to the browser.

Whatever the reason, redirects trigger an additional HTTP request-response cycle and add round-trip-time latency. Therefore, it’s important to minimize the number of redirects issued by your website. However, when the redirect is not on your domain (website) then you can’t change anything! You can only stop using ads (i.e. stop inserting code for ads) or services that cause unwanted redirects.

To figure out which code (block) you are inserting is responsible for the redirects you can selectively disable (pause) blocks to see the difference. Pause all the active blocks and then enable (unpause) one by one and check results after each change.

Please note that by simply disabling the plugin you are also disabling insertion of all the blocks (ad codes) you have configured and may use redirects, therefore, this does not mean that the plugin is doing redirects or slowing down your site. When you pause all the blocks the Ad Inserter is still active and processes the blocks, it only doesn’t insert any code on the pages. This is the real test to see the difference with and without Ad Inserter. With all blocks disabled you should see no difference in page loading time or performance scores when the plugin is active or disabled.

Processing of your PHP code used in some code blocks may also increase page loading time.

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
PLUGIN HOOKS PROCESSING: 0.00 ms
BLOCK 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).

PLUGIN HOOKS PROCESSING time is the time used to process your custom code using Ad Inserter custom hooks.

BLOCK 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.

PRO If you are using internal tracking, the website has a lot of visitors but not enough capacity on the server to process tracking requests, you may experience heavier load. In such case you need to disable internal tracking and use external tracking.

Some advices

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.

Reduce the number of installed plugins

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:

Optimize page code and scripts on the page

You can use caching or optimizing plugins (like Autoptimize) to optimize page code and scripts used in order in reduce page loading time.

Please note that Ad Inserter supports many client-side functions – functions that run in the browser of the visitor. These functions use Javascript code which relies on jQuery library which is normally loaded by WordPress. jQuery is an open source JavaScript library which is designed to provide easy client side scripting for HTML. It works on all major browsers. jQuery is widely used to perform various tasks on the client’s browser saving bandwidth and providing a better user experience. Normally jQuery is loaded from the <head> section and should be ready for any Javascript code that will need it.

However, some caching or optimizing plugins (like Autoptimize) may move it to the page footer or mark it with defer attribute so the browser will not wait for it to be loaded. This may cause Javascript errors as some code may not find jQuery as it is not loaded yet. To solve this problem Ad Inserter has an option Wait for jQuery (tab ⚙, tab General) which when enabled, will add additional code that will wait for jQuery to be loaded and ready before it will run own Javascript code for client-side functions. By default Wait for jQuery option is disabled. Enable it only when you see error jQuery is not defined.