WordPress
You have two solid options on WordPress. Use a plugin if you'd rather not touch code, or a child theme if you're comfortable editing PHP. Both add the widget to every page.
Option 1: a code-insertion plugin (no code) #
This is the easiest and safest route. Install a plugin like WPCode or Insert Headers and Footers, then:
- Open the plugin's settings.
- Paste the snippet into the Footer (or "before
</body>") box:
<script
src="https://api.plotap.com/widget.js"
data-key="hx_pub_your_key_here"
defer
></script>
- Save. The widget now loads site-wide.
Option 2: a child theme (code) #
If you maintain a child theme, add the script with the wp_footer hook in your child theme's functions.php:
add_action('wp_footer', function () {
?>
<script
src="https://api.plotap.com/widget.js"
data-key="hx_pub_your_key_here"
defer
></script>
<?php
});
Don't edit the parent theme directly
Pasting code into a parent theme's files works until the theme updates, then your change is wiped. Always use a child theme or a code-insertion plugin so updates can't remove the widget.
The data-key is your public key and is safe to publish; it only works from the origins you allow. See Quotas, origins & keys and the general Installation steps to verify it's live.