E-Commerce Platforms
Installing Scoby Analytics on Shopware
Like all Scoby integrations, this lightweight, client-side integration is carefully designed to prioritize visitor privacy. It fully complies with EU ePrivacy and GDPR regulations, while enabling you to exercise your legitimate interest in understanding how your website is being used.
Prerequisites
Before you start, make sure you have the following ready:
- A Scoby Analytics Workspace
- Your Workspace ID
- Access to your Shopware 6 Administration Panel
Installation Guide
- Log in to your Shopware Administration.
- Navigate to Settings → System → Themes.
- Choose your active theme and click Edit.
Shopware allows you to inject custom code into the storefront via the Theme → Custom JavaScript field or by editing the base template.
- Scroll to the Custom JavaScript section.
- Paste the following code into the field.
Replace<WORKSPACE_ID>
with your actual Workspace ID.
(function () {
const workspaceId = "<WORKSPACE_ID>";
window.scoby = window.scoby || function () {
(window.scoby.q = window.scoby.q || []).push(arguments);
};
window.scoby('init', { autoLogging: false });
// Log page views
document.addEventListener("DOMContentLoaded", function () {
const url = window.location.href;
const referrer = document.referrer;
window.scoby('logPageView', { url, referrer });
});
// Log order confirmations (conversion logging)
document.addEventListener('DOMContentLoaded', function () {
const body = document.body;
if (body && body.classList.contains('is-ctl-checkout') && body.classList.contains('is-act-finish')) {
try {
const orderAmount = window.ScyOrderTotal || undefined;
const orderCurrency = window.ScyOrderCurrency || undefined;
const goal = "Purchase";
window.scoby('logConversion', { goal, amount: orderAmount, currency: orderCurrency });
} catch (e) {
console.warn("Scoby Analytics: could not log order", e);
}
}
});
const script = document.createElement('script');
script.src = `https://${workspaceId}.s3y.io`;
document.head.append(script);
})();
- Then click Save and Recompile the Theme to apply the changes.
- In Settings → System → Caches & Indexes, click Clear Cache.
- Refresh your storefront to verify the script loads correctly.
That’s it 🎉
Scoby Analytics will now start collecting anonymous visit and conversion data from your Shopware storefront. You can view your live statistics in the Scoby Analytics Dashboard shortly after installation.