Setting Up PageWorkers
Updated over a week ago

🛠 This article provides the setup steps required for PageWorkers, part of Botify's Activation Suite, available as an option with all Botify plans.

Overview

To prepare 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

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>

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 placed after any A/B testing solutions but 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 the 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 *.pw.adn.cloud

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

Example:

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

Connect-src directive

If your CSP includes the connect-src directive, append *.pw.adn.cloud

Why?: This will allow PageWorkers script to interact with Botify's APIs.

Example:

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

Read next:

Did this answer your question?