WordPress Installation
Installing VersaTailor on your WordPress website can be done in several ways. Choose the method that works best for your setup and comfort level with WordPress.
Step 1: Get Your Tracking Script
- Log in to your VersaTailor dashboard
- Click on the website dropdown in the top navigation
- Select "Site Settings" from the dropdown menu
- In the General tab, copy your unique tracking script
Your tracking script will look like this:
<script
defer
src="https://versatailor.com/script.js"
data-website-id="your-website-id-here"
data-domain="yourdomain.com"
></script>
Method 1: Using WordPress Admin (Recommended)
The easiest way to install VersaTailor is through your WordPress admin dashboard:
- Log in to your WordPress admin dashboard
- Navigate to Appearance > Theme Editor
- Select your active theme
- Click on header.php from the file list
- Find the
</head>
closing tag - Paste your VersaTailor tracking script just before the
</head>
tag - Click Update File
⚠️ Important: Editing theme files directly means you'll lose your tracking script if you update your theme. Consider using a child theme or one of the alternative methods below.
Method 2: Using a Plugin (Safest)
Using a plugin ensures your tracking script won't be lost during theme updates:
Option A: Insert Headers and Footers Plugin
- Install the "Insert Headers and Footers" plugin from the WordPress plugin directory
- Activate the plugin
- Go to Settings > Insert Headers and Footers
- Paste your VersaTailor tracking script in the "Scripts in Header" section
- Click Save
Option B: Head, Footer and Post Injections Plugin
- Install the "Head, Footer and Post Injections" plugin
- Activate the plugin
- Go to Settings > Header and Footer
- Paste your tracking script in the "HEAD Page Section Injection" field
- Click Save Changes
Method 3: Using functions.php
For developers who prefer to add code to their theme's functions.php file:
// Add this to your theme's functions.php file
function add_versatailor_tracking() {
?>
<script
defer
src="https://versatailor.com/script.js"
data-website-id="your-website-id-here"
data-domain="yourdomain.com"
></script>
<?php
}
add_action('wp_head', 'add_versatailor_tracking');
Method 4: Using WordPress Customizer
Some themes support adding custom scripts through the WordPress Customizer:
- Go to Appearance > Customize
- Look for "Additional CSS" or "Custom Code" section
- If your theme supports it, you may find a "Header Scripts" or "Custom HTML" option
- Paste your VersaTailor tracking script there
- Click Publish
Step 3: Verify Installation
- Visit your WordPress website in a browser
- View the page source (Ctrl+U or Cmd+U)
- Search for "versatailor.com/script.js" to confirm the script is present
- Return to your VersaTailor dashboard
- Use the "Verify Installation" button in Site Settings
- Confirm that page views are being tracked
WooCommerce Integration
If you're running a WooCommerce store, you can track purchase events by adding this code to your theme's functions.php:
// Track WooCommerce purchases
function versatailor_track_purchase($order_id) {
$order = wc_get_order($order_id);
$total = $order->get_total() * 100; // Convert to cents
$email = $order->get_billing_email();
?>
<script>
window?.versatailor("payment", {
email: "<?php echo esc_js($email); ?>",
amnt: <?php echo $total; ?>
});
</script>
<?php
}
add_action('woocommerce_thankyou', 'versatailor_track_purchase');
🎉 You're All Set!
Your WordPress website is now tracking page views automatically. Visit your VersaTailor dashboard to see real-time analytics and visitor data.
Troubleshooting Tips
- If the script isn't loading, check that there are no JavaScript errors in your browser's console
- Ensure your VersaTailor script is placed in the
<head>
section, not the footer - Some caching plugins may require you to clear the cache after installation
- If using a security plugin, make sure it's not blocking the VersaTailor script
⚠️ Important: Always make sure to replace your-website-id-here
and yourdomain.com
with your actual website ID and domain from the VersaTailor dashboard.
Need help? Contact us for assistance.
Suggest features? We'd love your feedback