🛠 This document describes the customer requirements for implementing PageWorkers.
Overview
PageWorkers automatically updates elements in your site pages for SEO and displays them to bots, users, or both. PageWorkers lets you quickly take action on your SEO insights without coding or relying on other resources.
Implementation
PageWorkers optimizations are deployed through a JavaScript snippet you add to your site pages. When a browser loads a page that includes the snippet, it loads the following:
A JavaScript file that contains the optimizations that have been defined in Botify.
The code that will apply the optimizations to the pages.
The snippet applies each optimization to the current page if it is within the defined scope. The respective optimizations are not applied if the page is not within the scope. After all optimizations are executed on the page, the execution logs are sent to Botify.
The Botify JS snippet does not alter your page code. Optimizations are applied on top of your pages, which allows you to remove, deactivate, or change PageWorkers optimizations from Botify at any time, leaving your pages in their original state.
Compatibility
The Botify JavaScript snippet is compatible with all modern browsers used by bots.
Configuration
To configure your site to receive PageWorkers optimizations, you only need to add the JS snippet to your pages. When the snippet is included in your pages, the optimizations you create through PageWorkers will automatically display to bots, users, or both, depending on your settings in PageWorkers. If your site employs a Content Security Policy (CSP) against attacks, you may need to modify the Content-Security-Policy HTTP header.
Adding the Botify JS Snippet
💡 This is a high-level description of adding the Botify JS snippet. Refer to Tech Notes: Installing the Botify JS snippet for a detailed explanation.
Use your preferred HTML editor to add the following snippet in the <head> section of all HTML pages that will receive PageWorkers optimizations, replacing {websiteid} with your actual site ID (provided by your SEO Success Manager):
<script async src="https://tags.pw.adn.cloud/{websiteId}/activation.js"></script>
You can also access the snippet in PageWorkers Settings, as explained in Enabling/Disabling PageWorkers.
For example:
JS Snippet Location
Add the JS snippet as high as possible on the page, preferably within the <head> tag. The snippet can be after any A/B testing solutions, but it should be before other resources (e.g., CSS and fonts). You can also add it with a tag manager such as Google Tag Manager.
Confirming the Snippet Deployment
After deploying the snippet to your site, follow these steps to confirm it is installed:
Use your browser's "Inspect" function to view the source code on your site page where you deployed the snippet.
Use the browser's search function to search for a portion of the snippet (e.g., activation.js).
Confirm the snippet was only installed once.
The following example shows this procedure in Google Chrome:
Modifying the Content Security Policy (CSP) HTTP Header
To allow your Content Security Policy to load the PageWorkers script, you must make the following modifications to your Content-Security-Policy HTTP header if it includes the script-src
or connect-src
directive.
Script-src directive
If your CSP includes the script-src directive:
Append *.adn.cloud
Include the
unsafe-eval
directive
For example:
Content-Security-Policy: script-src 'self' ‘unsafe-eval’ *.adn.cloud
Why?
*.adn.cloud allows your website to load and execute PageWorkers’ scripts.
The
unsafe-eval
directive enables the PageWorkers template to be executed on runtime.
👉 If the script-src does not include the unsafe-eval
directive, PageWorkers will be limited to the following:
Removing/replacing URLs and managing nofollow URLs
Modifying titles/descriptions/H1s/canonicals based on a CSV file or specific data entered for specific URLs
Connect-src directive
If your CSP includes the connect-src
directive, append *.adn.cloud
Why? This will allow PageWorkers script to interact with Botify's APIs.
For example:
Content-Security-Policy: connect-src 'self' *.adn.cloud
Troubleshooting
In the unlikely event that Botify is experiencing an unexpected service interruption, optimizations will not be executed. If the CDN stops responding, the JavaScript snippet will not load, which will not prevent your original source page from loading. If the API stops responding, the JavaScript snippet will load, though it cannot execute the optimizations.
See also: