Skip to main content

Setting Up PageWorkers

Updated over 2 weeks 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 snippet to your pages. When the JS 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

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:

pw_tag.png

JS Snippet Location

Add the JS snippet as high as possible on the page, preferably within the <head> tag. The snippet 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 snippet 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:

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

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

  3. Confirm the snippet 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?