In this video, we'll show you how to add your snippet script to your WordPress site.
Where to find your Retention.com collection script
1. From your Retention Dashboard, click Code Script > View script. Next to Collection script, click Copy code.
You’ll see a confirmation in the top right-hand corner telling you the code was copied to your clipboard.
2. Once you’ve added the script to your domain, go back to Code Script > Authorized Domains. Click Edit domains.
3. Paste the domain/URL (where you installed the script) in the text box, and click Save.
It will be highlighted in green with a checkmark if the script is properly installed and tested—and in gray if the script is not properly added and/or tested.
How to add collection 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. You will have access to this once you collect onboarding.
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. You will have access to this once you collect onboarding.
How to add suppression 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 Script > View script. Next to Suppression script, 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. You will have access to this once you collect onboarding.
How to setup collection rules
You can setup rules that are used to automatically trigger a collection event based on the number of page views and/or seconds on a page. This allows you to collect higher-level contacts.
1. To setup the rules, click Code Script in the left-hand navigation and then click Settings.
2. In Collection rules, toggle On to Auto collect the contact after X page views, and type the number of Page Views in the box. For example, if you want a visitor to have 2 page views before the collection script is triggered, type ‘2’ in the box.
Toggle On to Auto collect the contact after X seconds on a single page, and type the number of Seconds in the box. For example, if you want the collection script to wait 10 seconds before it fires, type ’10’ in the box.
3. When you’re finished, click Save.
How to test your script to confirm it's working
Have questions? Message us on chat, or email us at support[at]retention.com!