WordPress Implementation Guide
Multiple methods to implement DATA Reshape tracking on WordPress. Choose the one that fits your setup.
Prerequisites
Only implement after receiving confirmation that your custom domain and SSL certificate are active.
You will need:
- Custom tracking subdomain (e.g.
dre2.YOUR_DOMAIN.TLD) - Script ID provided by the DATA Reshape team
You do not have to install everything by yourself. DATA Reshape provides hands-on implementation support and will perform the setup, audit, verification, and per-destination configuration on your WordPress site. To enable that, please create a dedicated Administrator account for us and email the credentials to [email protected].
- Role: Administrator (required to edit theme files, manage plugins, and access caching / security settings).
- Recommended: create a fresh user (e.g.
datareshape) instead of sharing an existing one — easier to track activity and revoke. - Access can be revoked at any time once the installation and verification are confirmed live.
After access is granted, DATA Reshape will install the tracking code (theme / functions / plugin method, whichever is safest for your setup), audit and clean up duplicate destination code, adjust any conflicting caching/minification settings, and run the end-to-end verification — then report back when everything is live.
Method 1: Official DATA Reshape plugin (Recommended for WooCommerce)
The fastest and safest install for WooCommerce stores — the official DATA Reshape plugin published on wordpress.org:
What it does:
- Injects the DATA Reshape tracking code on every front-end page (no theme edits, survives theme updates).
- Auto-maps WooCommerce events — product viewed, add/remove to cart, checkout started, order placed, etc. — into the DATA Reshape event vocabulary, so most ecommerce events flow without any custom coding.
- Reads the configured tracking subdomain and Script ID from a single settings page.
Install steps:
- In WordPress admin → Plugins → Add New → search
DATA Reshape WooCommerce(or use the direct link). - Click Install Now → Activate.
- Open the plugin's settings page → set Tracking subdomain (e.g.
dre2.YOUR_DOMAIN.TLD) and Script ID → Save. - Clear any caching plugins.
For non-WooCommerce WordPress sites, use one of the manual install methods below (Theme header, functions.php, child theme, or a generic headers-and-footers plugin). The events still need to be pushed from the page, but the tracking code itself loads exactly the same way.
Method 2: Theme header.php
The most reliable manual method when the plugin doesn't apply — works across all WordPress configurations.
- Go to Appearance → Theme Editor → select header.php
- Add this code before the
</head>tag:
<!-- DATA Reshape Tracking Code -->
<script>
(function(R,e,s,h,a,p,E){
var b=R.Reshape=R.Reshape||{};
b.setCookie=function(n,v,t,d){try{e.cookie=n+'='+v+';max-age='+t+';domain='+d+';path=/;SameSite=None;Secure';}catch(e){}};
b.id=a;b.cdn=h;b.sts=new Date().getTime();
E=e.getElementsByTagName(s)[0];p=e.createElement(s);p.async=true;p.src="https://"+h+"/main.js?id="+a;E.parentNode.insertBefore(p,E);
})(window,document,"script","YOUR_SUBDOMAIN","YOUR_SCRIPT_ID");
</script>
<?php wp_head(); ?>
</head>
- Click Update File and clear any caching plugins
Changes to theme files are lost during theme updates. Use a child theme or the functions.php method for persistence.
Method 3: functions.php
Programmatic implementation via WordPress hooks. Add to the end of Appearance → Theme Editor → functions.php:
function add_data_reshape_tracking() {
$subdomain = 'YOUR_SUBDOMAIN';
$script_id = 'YOUR_SCRIPT_ID';
if (!is_admin()) {
?>
<script>
(function(R,e,s,h,a,p,E){
var b=R.Reshape=R.Reshape||{};
b.setCookie=function(n,v,t,d){try{e.cookie=n+'='+v+';max-age='+t+';domain='+d+';path=/;SameSite=None;Secure';}catch(e){}};
b.id=a;b.cdn=h;b.sts=new Date().getTime();
E=e.getElementsByTagName(s)[0];p=e.createElement(s);p.async=true;p.src="https://"+h+"/main.js?id="+a;E.parentNode.insertBefore(p,E);
})(window,document,"script","<?php echo esc_js($subdomain); ?>","<?php echo esc_js($script_id); ?>");
</script>
<?php
}
}
add_action('wp_head', 'add_data_reshape_tracking');
Method 4: Insert Headers and Footers Plugin
If you prefer not to edit theme files:
- Plugins → Add New → search "Insert Headers and Footers" → install and activate
- Settings → Insert Headers and Footers → paste in Scripts in Header:
<script>
(function(R,e,s,h,a,p,E){
var b=R.Reshape=R.Reshape||{};
b.setCookie=function(n,v,t,d){try{e.cookie=n+'='+v+';max-age='+t+';domain='+d+';path=/;SameSite=None;Secure';}catch(e){}};
b.id=a;b.cdn=h;b.sts=new Date().getTime();
E=e.getElementsByTagName(s)[0];p=e.createElement(s);p.async=true;p.src="https://"+h+"/main.js?id="+a;E.parentNode.insertBefore(p,E);
})(window,document,"script","YOUR_SUBDOMAIN","YOUR_SCRIPT_ID");
</script>
- Click Save and clear cache
Method 5: Child Theme
For persistence during theme updates. Create /wp-content/themes/your-child-theme/functions.php:
<?php
function add_data_reshape_tracking() {
if (!is_admin()) {
?>
<script>
(function(R,e,s,h,a,p,E){
var b=R.Reshape=R.Reshape||{};
b.setCookie=function(n,v,t,d){try{e.cookie=n+'='+v+';max-age='+t+';domain='+d+';path=/;SameSite=None;Secure';}catch(e){}};
b.id=a;b.cdn=h;b.sts=new Date().getTime();
E=e.getElementsByTagName(s)[0];p=e.createElement(s);p.async=true;p.src="https://"+h+"/main.js?id="+a;E.parentNode.insertBefore(p,E);
})(window,document,"script","YOUR_SUBDOMAIN","YOUR_SCRIPT_ID");
</script>
<?php
}
}
add_action('wp_head', 'add_data_reshape_tracking');
Caching Plugins
| Plugin | Action |
|---|---|
| WP Rocket | Settings → File Optimization → add subdomain to Excluded Inline JavaScript |
| W3 Total Cache | Performance → Minify → add to "Never minify" JS list |
| WPEngine | No configuration needed |
Verification
End-to-end verification is performed by the DATA Reshape team. Reach out at [email protected] once the tracking code is installed, and we will run the confirmation tests, validate the data flowing to each connected destination, and confirm the configuration is correct.
The tracking surface is built privacy-first: payloads are obfuscated, PII is normalized and hashed before it leaves the browser, sensitive parameters are encrypted at rest, identity is partitioned per account, and destination-specific protections (such as opt-out signals, data-minimization filters, and limited-use modes) are applied server-side before any downstream call.
Because of these advanced privacy and tracking protections, the data observable from the outside is intentionally not enough to validate quality on your own. DATA Reshape is the only party with the visibility needed to confirm that events, identifiers, conversions, and destination deliveries are correct end-to-end.
Privacy by design is a feature of the platform, not an inconvenience — it's what keeps the implementation compliant out of the box and protects your customers' data regardless of which destinations you connect later.
Troubleshooting
A few WordPress-specific install-time issues you can fix yourself:
| Symptom | Likely cause | Fix |
|---|---|---|
| Script not present in page source | wp_head() is not called inside header.php, or the chosen install method does not run on the front end | Confirm wp_head() is invoked in your theme's <head>, or switch to the Insert Headers and Footers plugin method. |
| Script loads on some pages only | Install method is template-specific (e.g. only single posts) | Ensure the method runs on every page type (homepage, pages, posts, categories, products if WooCommerce). |
| Script suppressed after enabling a security or minification plugin | Plugin conflict | Temporarily deactivate security/minification plugins and confirm the script reappears; whitelist the subdomain in the plugin's configuration. |
| Old script appears even after replacing the code | Page or object cache still serves an older response | Clear all caches (WP cache, CDN, browser) and re-test in incognito. See the Caching Plugins table above. |
For anything beyond install-time visibility — events that don't seem to arrive, deduplication concerns, destination-side discrepancies, or any other doubt about data quality — please contact [email protected]. By design, the only reliable view into event flow and destination delivery is the internal one; we'll confirm the state, identify the cause, and guide the fix.