Google Tag Manager
Deploy edrone tracking using Google Tag Manager for easier management.
Benefits
- Centralized management - all tags in one place
- No code changes - deploy without developer help
- Version control - rollback if needed
- Testing - preview before publishing
Setup
1. Create edrone initialization tag
- Go to GTM → Tags → New
- Choose Custom HTML
- Paste the initialization code:
<script type="text/javascript">
(function (appId) {
window._edrone = window._edrone || {};
_edrone.app_id = appId;
_edrone.platform = 'custom';
var doc = document.createElement('script');
doc.type = 'text/javascript';
doc.async = true;
doc.src = "https://d3bo67muzbfgtl.cloudfront.net/edrone_2_0.js?app_id=" + appId;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(doc, s);
})("YOUR_APP_ID");
</script>
- Set trigger: All Pages
- Save and name it "edrone - Initialization"
2. Create event tags
For each event type, create a Custom HTML tag:
Product View tag
<script type="text/javascript">
window._edrone = window._edrone || {};
_edrone.action_type = 'product_view';
_edrone.product_ids = '{{Product ID}}';
_edrone.product_titles = '{{Product Title}}';
_edrone.product_images = '{{Product Image}}';
_edrone.product_urls = '{{Product URL}}';
_edrone.product_category_ids = '{{Category IDs}}';
_edrone.product_category_names = '{{Category Names}}';
</script>
Trigger: Page View - Product pages only
3. Create Data Layer variables
Create GTM variables for product data:
| Variable Name | Data Layer Variable |
|---|---|
| Product ID | ecommerce.detail.products.0.id |
| Product Title | ecommerce.detail.products.0.name |
| Product Image | ecommerce.detail.products.0.image |
| Product URL | ecommerce.detail.products.0.url |
4. Push data to Data Layer
On your website, push product data:
dataLayer.push({
ecommerce: {
detail: {
products: [{
id: '12345',
name: 'Nike Air Max 90',
image: 'https://store.com/img.jpg',
url: 'https://store.com/product/nike',
category: 'Shoes/Sneakers/Nike'
}]
}
}
});
Testing
- Click Preview in GTM
- Visit your store
- Check that tags fire correctly
- Verify requests to
api.edrone.mein browser DevTools
Publishing
After testing:
- Click Submit in GTM
- Add version name and notes
- Click Publish