Global Code Setup Overview
The DATA Reshape tracking library enables server-side tracking across all pages by collecting event data, managing user sessions, and streaming information to your analytics and marketing platforms.
What is the Global Code?
The global tracking code is a lightweight JavaScript library that:
- Collects Event Data - Captures user interactions and behaviors
- Manages User Sessions - Tracks visitors across multiple events
- Forwards Data - Sends information to your analytics and marketing platforms
- Ensures Privacy - Operates under your domain for first-party data collection
- Bypasses Limitations - Avoids ad blockers and browser restrictions
Prerequisites
Only implement after receiving confirmation that your custom domain and SSL certificate are active.
Required Information:
- Custom tracking subdomain (e.g.,
dre2.yourdomain.com
) - Script ID provided by DATA Reshape team
- Website access to modify HTML/code
Quick Implementation
The basic implementation involves adding this code to your website's <head>
section:
<script>
(function(R,e,s,h,a,p,E){
R[s+a]=a;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_TRACKING_DOMAIN","YOUR_SCRIPT_ID");
</script>
Replace YOUR_TRACKING_DOMAIN
with your actual subdomain and YOUR_SCRIPT_ID
with the ID provided by DATA Reshape team.
Platform-Specific Implementation
Choose the implementation guide that matches your platform:
General Websites
For custom websites, HTML sites, or any platform not listed below.
→ General Implementation GuideWordPress
Complete WordPress implementation with multiple methods and WooCommerce support.
→ WordPress Implementation GuideShopify
Full Shopify integration using Theme, Customer Events and Custom Pixels.
→ Shopify Implementation GuideAdvanced Configuration Options
Multiple Library IDs
For websites with different sections requiring separate tracking:
<script>
// Determine Library ID based on page or section
const getLibraryId = () => {
const path = window.location.pathname;
if (path.startsWith('/shop/')) return 'ECOMMERCE_LIBRARY_ID';
if (path.startsWith('/blog/')) return 'BLOG_LIBRARY_ID';
return 'MAIN_LIBRARY_ID';
};
(function(R,e,s,h,a,p,E){
R[s+a]=a;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","sub.yourdomain.com",getLibraryId());
</script>
Content Security Policy (CSP)
If your website uses Content Security Policy, add these directives:
<meta http-equiv="Content-Security-Policy" content="
script-src 'self' 'unsafe-inline' https://sub.yourdomain.com;
connect-src 'self' https://sub.yourdomain.com;
">
Common Implementation Issues
Library Not Loading
Symptoms: No request to your subdomain in Network tab
Most Common Causes:
- DNS configuration not complete
- SSL certificate not active
- Incorrect subdomain URL
Solution: Contact DATA Reshape team to verify server configuration
CORS Errors
Symptoms: Cross-Origin Resource Sharing errors in console
Most Common Causes:
- SSL certificate not properly configured
- DNS propagation still in progress
Solution: Wait 24-48 hours for DNS propagation or verify SSL certificate
Events Not Tracking
Symptoms: Library loads but no data appears in your destinations
Most Common Causes:
- Incorrect Script ID
- Events not properly implemented
- Looking at wrong date range
Solution: Verify Script ID and proceed to event implementation
What Happens After Implementation?
Once the global code is successfully implemented:
Immediate Benefits
- Page View Tracking - Automatic visitor and session tracking
- User Identification - Unique visitor identification across sessions
- Basic Analytics - Foundation for all other tracking events
Next Steps
- Verify Implementation - Confirm library loads without errors
- Add Event Tracking - Implement business-specific events
- Include Customer Data - Add user identification and properties
- Configure Destinations - Connect to your analytics platforms
Event Implementation Paths
Choose your next step based on your business type:
E-commerce Tracking
For online stores and product-based businesses:
- Product view events
- Shopping cart tracking
- Purchase completion
- Revenue attribution
Lead Generation Tracking
For service businesses and B2B companies:
- Form submission tracking
- Lead qualification events
- Contact information capture
- Conversion funnel analysis
Custom Event Tracking
For unique business requirements:
- Custom event definitions
- Advanced user properties
- Business-specific metrics
- Technical implementation
Technical Support
- Implementation Questions - Contact DATA Reshape team for setup assistance
- Event Planning - Get guidance on which events to implement
- Custom Requirements - Discuss advanced features and custom solutions