Integrations
Integrating Gooddata with WordPress
Adding Gooddata to your WordPress project is a simple, straightforward process. Follow the step-by-step instructions below to start tracking your visitors without compromising their privacy.
Step 1: Copy Your Project ID
Before you begin, you need your unique Gooddata Project ID.
- Log in to your Gooddata Dashboard.
- Select your project from the sidebar.
- Click on the Settings gear icon in the bottom left.
- Copy the
Project IDor the provided tracking snippet block.
Step 2: Add the Script to WordPress
There are two primary ways to add code to the header of a WordPress site.
Option 1: Using a Plugin (Easiest)
- Log in to your WordPress Admin Dashboard.
- Go to Plugins > Add New and search for "WP Headers and Footers" (or any header code injection plugin).
- Install and activate the plugin.
- Go to the new Settings > WP Headers and Footers menu.
- In the "Scripts in Header" box, paste the Gooddata script.
- Replace
<YOUR_PROJECT_ID>with your ID and click Save.
Option 2: Editing your Theme (Advanced)
If you prefer not to use a plugin, you can edit your theme files directly.
- Go to Appearance > Theme File Editor.
- On the right sidebar, click on the Theme Functions (
functions.php) file. - Scroll to the very bottom and paste the PHP snippet shown below.
- Replace
<YOUR_PROJECT_ID>with your ID and click Update File.
<!-- Option 1: Using a Plugin (Insert Headers and Footers) -->
<!-- Paste the script in Settings > Insert Headers and Footers > Scripts in Header -->
<script defer data-project-id="<YOUR_PROJECT_ID>" src="https://gooddata-fyp.onrender.com/sdk/tracker.js"></script>
/* Option 2: Add to functions.php */
add_action('wp_head', 'add_gooddata_tracker');
function add_gooddata_tracker() {
echo '<script defer data-project-id="<YOUR_PROJECT_ID>" src="https://gooddata-fyp.onrender.com/sdk/tracker.js"></script>';
}
Step 3: Verify the Installation
Once you have added the script and published your changes, it's time to test if Gooddata is receiving data.
- Open your live website in a new incognito/private browsing window.
- Navigate to a few different pages.
- Return to your Gooddata Dashboard and go to the Realtime tab.
- You should see "1 Active Visitor" and your recent page views populating instantly.
Troubleshooting: If you don't see any data, make sure you don't have an adblocker enabled that might be blocking the script, and ensure you replaced <YOUR_PROJECT_ID> with your actual ID.