# WordPress

{% hint style="info" %}
**Note:** ReferralHero cannot be used on free hosted WordPress.com websites, as these platforms do not support the installation of custom plugins. Additionally, custom JavaScript is blocked from being embedded on such sites. If your WordPress blog uses caching plugins, please ensure you clear the cache to properly integrate the script.
{% endhint %}

To install the ReferralHero Tracking Code on your WordPress theme, one option is to add it directly to the `header.php` file. However, modifying the theme in this way will only affect your local copy of the theme. This means that if the theme is updated or re-installed later, your changes, including the ReferralHero Tracking Code, will be lost.

To avoid this, we recommend using a WordPress Script Management Plugin. This approach ensures that your tracking code remains intact, even if the theme is updated.

## **Installing ReferralHero using a Script Installation Plugin** <a href="#installing-referralhero-using-a-script-installation-plugin" id="installing-referralhero-using-a-script-installation-plugin"></a>

**Step 1:** First, check if you already have a header/footer script management plugin installed on your WordPress website. If you do not have one, there are several free options available to help you add scripts to the header or footer of your site. We recommend using either [**WPCode**](https://wordpress.org/plugins/insert-headers-and-footers/) or [**OH Add Script to Individual Pages Header Footer**](https://wordpress.org/plugins/oh-add-script-header-footer/).

**Step 2:** Install the selected header/footer script plugin on your WordPress website.

{% hint style="danger" %}
While issues with installing a WordPress script management plugin are uncommon, please note that any plugin you choose is not managed by ReferralHero. If you encounter any difficulties during installation or face compatibility issues, you will need to contact the plugin's author for support.
{% endhint %}

**Step 3:** Go to your ReferralHero *Campaign Overview > Edit Campaign > Launch instructions* and copy your **ReferralHero Global Tracking Code.**

<figure><img src="https://363135598-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsuqexOLPOWiUrWg_Ko%2Fuploads%2FMshCilWaEHTBbqK65Ohe%2Fimage.avif?alt=media&#x26;token=0f92fd15-c6bd-4bc8-8e2b-7f461bb42830" alt=""><figcaption></figcaption></figure>

**Step 4:** Use the plugin you installed to paste the ReferralHero Tracking Code into the header of your site. If you are using the **OH Add Script** plugin, paste the script into the designated box as shown below.

<figure><img src="https://363135598-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsuqexOLPOWiUrWg_Ko%2Fuploads%2FaEUh0wfARMOZIyRfsYrl%2Fimage%20(1).avif?alt=media&#x26;token=3065d5f0-0934-43be-91de-448a9086e0bc" alt=""><figcaption><p>In "add script to be added to the header of the page" section of the OH plug-in, add your global tracking code:</p></figcaption></figure>

```javascript
!function(m,a,i,t,r,e){if(m.RH)return;r=m.RH={},r.uuid
=t,r.loaded=0,r.base_url=i,r.queue=[],m.rht=function()
{r.queue.push(arguments)};e=a.getElementsByTagName('script')
[0],c=a.createElement('script');c.async=!0,c.src=
'https://referralhero-global-code.s3.amazonaws.com/'+'production'+
'/'+t+'.js',e.parentNode.insertBefore(c,e)}(window,document,
'https://app.referralhero.com/','RHxxxxxxxxx');
```

{% hint style="warning" %}
Replace 'RHxxxxxxxxxx' with your unique uuid.
{% endhint %}

**Step 5:** [Download the ReferralHero plugin](https://app.referralhero.com/maitre-2-wp.php.zip) and install it on your website.

**Step 6:** Add the ReferralHero embeddable widgets on your page by pasting the special shortcode \<div id='referralhero-dashboard-MFxxxxxxxxxx'>\</div> exactly where you want the form to appear in your page.

<figure><img src="https://363135598-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LsuqexOLPOWiUrWg_Ko%2Fuploads%2FU99sxaFiQuDwjx3cEvPi%2Fimage.png?alt=media&#x26;token=bdea774a-0543-4e04-b252-a98c8b74ad40" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Replace the `MFxxxxxxxxxx` with your specific campaign UUID.
{% endhint %}
