# 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="/files/qIFoldBE3Z7q4DvYuLE1" 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="/files/uvTcAjBj9z9dtQksbYNb" 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="/files/LVhtTZnVKO15mTWQltGg" alt=""><figcaption></figcaption></figure>

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.referralhero.com/integrate/platform/wordpress.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
