How do I add the snippet script to my WordPress website?

In this video, we’ll show you how to add your snippet script to your WordPress site.

Where to find your Retention.com collection snippet script

1. From your Retention Dashboard, click Code Script.  Then, click View Your Script.

2. Check the box next to Collection, and then click Copy Code </>. You’ll see a green box in the top right-hand corner telling you the code was copied to your clipboard.

Copy Collection

Remember: You can’t check multiple boxes for scripts or you will get an error message. You can only copy one at a time.

3. Once you’ve added the script to your domain, go back to Code Script and click the edit icon next to Authorized Domains.

4. Paste the domain/URL in the text box where you added the script, and click Save Changes.

It will be highlighted in green if the script is properly installed—and in orange if the script is not properly added.

How to add collection snippet script

There are two options for adding the script to your WordPress site. You can use a free plugin or add directly to the code. We recommend using the plugin if you can.

Add Script Using a Free Plugin

1. From your WordPress Dashboard, click Plugins on the left navigation, then click Add New.

2. On the top right, where it says Search Plugins, search for “Header and Footer Scripts.”

This is the plugin you are searching for: https://wordpress.org/plugins/header-and-footer-scripts/

3. Click Install Now. 

4. Once the plugin is installed, press Activate.

5. Return to your WordPress dashboard and click Pages on the left navigation. Click to edit the page you would like to add the Retention.com script to. The Header and Footer Scripts plugin will have added a box at for you to insert the tracking script. Paste the script into this box. Make sure to press the Save/Update/Publish button in the top right of the page to save the update.

6. If this plugin doesn’t work for you, try the “Header Footer Code Manager” plugin.

7. From your Retention.com dashboard, click On next to Script Status to turn your script on.

Add Script Directly to Code

1. Click on Appearance → Theme Editor

2. Click on header.php on the right to access the header file:

3. The header section is between <head> and </head>. Paste the script in this section.

4. Click on Update Files button to save your changes.

5.  From your WordPress Plugins, find your Cache plugin and navigate to Settings. For your plugin, find where you can clear any/all caches. For WP Rocket, this is seen here:

6. Additionally, if you are using a CDN, you should make sure that you exclude the Retention.com URL from it. In WP Rocket, this can be done under the CDN menu. Add /ge.js in the exclude field, and Save:

7. From your Retention.com dashboard, click On next to Script Status to turn your script on.

How to add suppression snippet script

The suppression script can be added to your website on any pages that you do NOT want Retention.com to collect email addresses. Generally speaking, you would put this script on landing pages where the person has already converted, and therefore, you have already collected their email address.

Examples of pages you’d want to add the suppression script to are post-checkout, thank you, and confirmation pages.

1. From your Retention.com Dashboard, click Code Snippet in the left navigation and then View Script. Then, check the box next to Suppression, and click Copy Code.

2. After you’ve installed the plugin following the steps above (Add Script Using a Free Plugin), click Pages on the left navigation from your WordPress dashboard. Then, click to edit the page you would like to add the Retention.com suppression script to.

3. The Header and Footer Scripts plugin will have added a box at the top of the page for you to insert the tracking script. Paste the suppression script into this box. Make sure to press the Save/Update/Publish button in the top right of the page to save the update.

4. From your Retention.com dashboard, click On next to Script Status to turn your script on.

How to test your script to confirm it’s working

Click here to learn how to test your script.