DATA Reshape Documentation
website·Indexed 32 days ago
https://kb.datareshape.roTechnical documentation for DATA Reshape, covering event tracking, custom integrations, and destination setup. Includes detailed payload references for e-commerce events like checkout_completed, cart_viewed, and product_viewed, as well as configuration guides for Google Ads, Google Analytics 4, Meta (Facebook) Pixel, and TikTok.
What's inside DATA Reshape
- Destinations are the analytics, advertising platforms, or custom systems where DATA Reshape delivers processed tracking data. The delivery process follows these steps: events are collected via tracking scripts or webhooks, processed and enriched by DATA Reshape, and then delivered server-side to destinations based on the account configuration mapping.
Define the context object for API requests
Thecontextobject is required and provides metadata about the environment and the user's session/device.{ "context": { "environment": "prod", // string (required): 'prod' or 'dev' "data_source": "website", // string (recommended): 'website', 'phone', 'admin', 'app', 'marketplace' "user_agent": "Mozilla/5.0...", // string (recommended) "override_ip": "203.0.113.1", // string (recommended) - IPv4 or IPv6 "url": "https://example.com/thank-you", // string (recommended) "landing_url": "https://example.com/landing-page", // string (recommended) "referrer_url": "https://example-search.com" // string (recommended) } }Send events to DATA Reshape via the Event Create API
The/webhooks/reshape/eventendpoint is a universal API for server-side tracking of e-commerce, CRM, and enterprise application events. It supports production and testing environments to validate payloads synchronously.POST /webhooks/reshape/event Content-Type: application/jsonUnderstand DATA Reshape consent enforcement and default state
DATA Reshape acts as a gatekeeper for all data flowing to connected destinations. By default, all visitors start in a default-denied state foranalytics,personalization, andmarketing. Tracking runs in a GDPR-restricted mode until an explicit consent signal is received. Consent is enforced automatically across all destinations, removing the need for per-destination privacy logic.Configure event context parameters
Thecontextobject provides environmental data about where the event occurred. Be cautious of including sensitive personal identifiers or session tokens in theurlquery parameters to comply with privacy regulations.context: { url: "https://example.com/", page_type: "product", // e.g., 'product', 'home' environment: "prod" // Allowed values: 'prod', 'dev' }Implement Context Web Object updates for SPA route changes
In Single Page Applications, the browser URL does not trigger automatic page context updates. You must manually push a new event with the updatedurland context on every route change.// On each SPA route change, push a new event with the current route URL window.reshape = window.reshape || []; reshape.push({ event: { name: "page_viewed" }, context: { url: currentRouteUrl, // Current route URL from your framework's router page_type: "dashboard", environment: "prod" } });Manually install DATA Reshape via theme header.php
This method works across all WordPress configurations but is susceptible to being overwritten during theme updates. Add the tracking script immediately before the closing</head>tag in theheader.phpfile.<!-- 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","dre2.YOUR_DOMAIN.TLD","YOUR_SCRIPT_ID"); </script>Prerequisites for DATA Reshape WordPress implementation
Before implementing DATA Reshape on WordPress, ensure that your custom domain and SSL certificate are active. You will need the following credentials provided by the DATA Reshape team:
- Custom tracking subdomain (e.g.,
dre2.YOUR_DOMAIN.TLD) - Script ID
- Custom tracking subdomain (e.g.,
Use custom product properties for audience segmentation
Thepropertiesobject within a product allows for free-form key-value pairs used for advanced segmentation and personalization in marketing campaigns. This is particularly useful for attributes like color, size, material, or technical specifications.// Example for Electronics properties: { color: "space_gray", storage: "256GB", memory: "16GB", connectivity: ["wifi", "bluetooth"], warranty: "2_years" } // Example for Fashion properties: { color: ["black", "white"], size: "M", material: "cotton", fit: "regular" }Trigger the user_updated event for profile changes
The
user_updatedevent is triggered when an authenticated user modifies profile information (name, address, marketing preferences). To ensure data synchronization across downstream destinations, follow these best practices:- Send the full identity: Include all known user fields, not just the changed ones.
- Include
user.id: This is required to match the update to an existing profile. - Fire on save: Trigger the event upon form submission/save, not on every keystroke.
- Use
update_type: Capture the type of update inevent.propertiesfor better analytics segmentation. - Prefer server-side: Fire the event from your account-update handler for maximum reliability.
window.reshape = window.reshape || []; reshape.push({ "event": { "name": "user_updated", "value": 0, "currency": "USD", "id": "userupd_abc123", "properties": { "update_type": "preferences_change" } }, "context": { "url": "https://example.com/account/preferences", "page_type": "account", "environment": "prod" }, "user": { "id": "cust_abc123", "email": "example.customer@example.com", "country": "US", "properties": { "marketing_consent": false, "preferred_language": "en", "preferred_categories": ["apparel", "accessories"] } } });Implement the lead_closed event for sales pipeline tracking
The
lead_closedevent should be fired when a lead reaches a final stage in the sales pipeline (e.g., Closed Won or Closed Lost). This serves as a bottom-of-funnel signal for B2B and high-consideration purchases. It is typically fired server-side from a CRM. To allow destinations to compute true ROAS, use the sameevent.idas the originallead_createdevent.DATA Reshape automatically maps this single event to multiple destinations:
- Google Ads: Uploaded as an offline conversion using
transaction_idfromevent.idand Enhanced Conversions from theuserobject. - Meta Pixel / Conversions API: Sent as a custom CamelCase event (e.g.,
LeadClosed,LeadClosedWon, orLeadClosedLost). - TikTok Pixel / Events API: Sent as a custom CamelCase event
LeadClosed. - GA4: Mapped as a custom event.
- Google Ads: Uploaded as an offline conversion using
Track shipping method selection with shipping_detail_added
Fire the
shipping_detail_addedevent when a visitor selects or confirms a shipping method (e.g., standard, express, store pickup) during checkout. This event should be triggered once per confirmed selection; if a user changes their shipping method, fire the event again.DATA Reshape automatically maps this single event to multiple native platform events:
- Google Analytics 4:
add_shipping_info - TikTok Pixel / Events API:
AddShippingInfo - Meta: Custom CamelCase event
AddShippingInfo(when connected).
{ "event": { "name": "shipping_detail_added" } }- Google Analytics 4: