Skip to main content
PageWorkers Implementation
Updated over 4 months ago

🛠 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 tag you add to your site pages. When a browser loads a page that includes the PageWorkers tag, 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 tag 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 PageWorkers tag 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 PageWorkers JavaScript tag is compatible with all modern browsers used by bots.

Configuration

To configure your site to receive the PageWorkers optimizations, you only need to add a JavaScript tag to your pages. When the JS tag 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 PageWorkers JS Tag

💡 This is a high-level description of adding the PageWorkers tag. Refer to Tech Notes: Installing the PageWorkers Tag for a detailed explanation.

Use your preferred HTML editor to add the following tag 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 tag in PageWorkers Settings, as explained in Enabling/Disabling PageWorkers.

For example:

pw_tag.png

Location of JS Tag

Add the JS tag as high as possible on the page, preferably within the <head> tag. The tag can be after any A/B testing solutions, but it should be before other resources (e.g., CSS and fonts). You can also add the tag with a tag manager such as Google Tag Manager.

Confirming the Tag Deployment

After deploying the tag to your site, follow these steps to confirm the tag is installed:

  1. Use your browser's "Inspect" function to view the source code on your site page where you deployed the tag.

  2. Use the browser's search function to search for a portion of the tag (e.g., activation.js).

  3. Confirm the tag was only installed once.

The following example shows this procedure in Google Chrome:

pw_confirm_tag_gtm.gif

Modifying the Content Security Policy (CSP) HTTP Header

You may need to change your Content-Security-Policy HTTP header to allow your CSP to load the PageWorkers script. If your CSP includes the script-src or connect-src directive, please make the below modifications.

Script-src directive
If your CSP includes the script-src directive, append *.adn.cloud

Why? This will allow your website to load and execute PageWorkers’ scripts.

For example:

Content-Security-Policy: script-src 'self' *.adn.cloud

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 tag will not load, which will not prevent your original source page from loading. If the API stops responding, the JavaScript tag will load, though it cannot execute the optimizations.


See also:

Did this answer your question?