Skip to main content

Implementing Adsterra Code on WordPress

Problem Summary

Users experience a 403 Forbidden error when attempting to add Adsterra ad codes in WordPress, triggered by Imunify360 identifying the code as potential malware. Moreover, these codes are also removed during weekly database scans and file edits due to security protocols.

Root Cause

Imunify360 integrates with ModSecurity and has extensive malware scanning capabilities, which can mistakenly flag legitimate ad scripts like Adsterra as malware, especially in environments like WordPress where dynamic content is frequent. It is important to note that this issue is not specific to Middlehost's hosting environment. Adsterra is aware of how their scripts are perceived by security systems and addresses these concerns in their official statement regarding the use of their ad codes and security practices.


Solutions

By opting for these changes, you acknowledge and agree that any security issues that arise as a result of these modifications may not be covered under our standard Free Malware Cleanup Policy. While these adjustments are made to accommodate the use of Adsterra ad codes, they potentially expose your site to other security vulnerabilities.

We provide two main solutions to enable the use of Adsterra code:

Option 1: Disable Specific Security Features for Your Account

We can customize the security settings by disabling certain ModSecurity rules related to malware protection and turning off database scans for your website. This allows the Adsterra code to operate without being blocked or removed.

Procedure:

  1. Submit a support ticket at http://secure.middlehost.com/tickets/new requesting the deactivation of specific ModSecurity rules and database scans. In support ticket mention your IP as detected on https://wimip.info and the URL where you encountered 403 error.
  2. Our support team will make the necessary adjustments and notify you once the changes are effective.

Option 2: Designate a Specific Theme File for Adsterra Code

For a more secure approach, follow these steps to add Adsterra code to a specific theme file created exclusively for this purpose:

  1. Create a new file in your theme directory, e.g., custom-ads.php.
  2. Submit a support ticket at http://secure.middlehost.com/tickets/new. Provide the complete file path of the new file you intend to use for the Adsterra code. This step is crucial to ensure that the file is pre-approved and added to the Imunify360 ignore list before you proceed with adding any code.
  3. Wait for confirmation from our support team that the file has been added to the ignore list. This confirmation will ensure that the file will not trigger any malware detection systems.
  4. Include the new file in your theme’s functions.php or footer.php file to ensure it's executed:
  5. Add the Adsterra code

    inside the custom-ads.php file after receiving confirmation from our support team.

    This order of operations helps to avoid potential security flags by Imunify360, ensuring that your integration of Adsterra code is smooth and uninterrupted.

    Additional Support

    • Developer Assistance: We recommend contacting your developer to implement the code securely. If you require our assistance to integrate this functionality into your theme, please mention this in your support ticket. There is a nominal charge of $5 for this service.
    • Security Best Practices: Using a designated file like custom-ads.php is safer than modifying common files such as header.php or footer.php, as it limits the scope of what needs to be excluded from security scans.

    Contact Support

    For assistance with these options or to discuss which solution best fits your needs, please reach out via our support ticket system: http://secure.middlehost.com/tickets/new. Our team is ready to ensure your site’s smooth and secure operatio