feat(gtm-manager): Rename to ourdigital-gtm-manager and add dataLayer injector

BREAKING CHANGE: Renamed from 13-gtm-audit to 13-ourdigital-gtm-manager

New Features:
- DataLayerInjector class for generating custom HTML tags
- Support for 20+ GA4 event types (ecommerce, forms, video, engagement)
- Subcommand structure: audit and inject modes
- Preset tag generation (ecommerce, engagement, all)
- DOM scraping option for dynamic value extraction
- Generate tags from audit report findings
- Korean payment method support (카카오페이, 네이버페이, 토스)

CLI Changes:
- `python gtm_manager.py audit --url ...` for auditing
- `python gtm_manager.py inject --preset ecommerce` for tag generation
- `python gtm_manager.py inject --event purchase --event add_to_cart`
- `python gtm_manager.py inject --from-audit report.json`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-20 20:55:42 +09:00
parent fb2a653866
commit ec5e30c825
14 changed files with 1027 additions and 285 deletions

View File

@@ -0,0 +1,216 @@
# E-commerce DataLayer Schema Reference
## GA4 E-commerce Structure
### Items Array Schema
Every e-commerce event requires an `items` array:
```javascript
items: [{
// Required
item_id: "SKU_12345",
item_name: "Blue T-Shirt",
// Recommended
affiliation: "Store Name",
coupon: "SUMMER_SALE",
discount: 5.00,
index: 0,
item_brand: "Brand Name",
item_category: "Apparel",
item_category2: "Men",
item_category3: "Shirts",
item_category4: "T-Shirts",
item_category5: "Short Sleeve",
item_list_id: "related_products",
item_list_name: "Related Products",
item_variant: "Blue/Large",
location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
price: 29.99,
quantity: 1
}]
```
### Clear Previous E-commerce Data
Always clear before new e-commerce event:
```javascript
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "view_item",
ecommerce: {
// new data
}
});
```
## Complete Purchase Flow
### 1. Product List View
```javascript
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "view_item_list",
ecommerce: {
item_list_id: "category_results",
item_list_name: "Category Results",
items: [
{ item_id: "SKU_001", item_name: "Product 1", index: 0, price: 29.99 },
{ item_id: "SKU_002", item_name: "Product 2", index: 1, price: 39.99 }
]
}
});
```
### 2. Product Click
```javascript
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "select_item",
ecommerce: {
item_list_id: "category_results",
item_list_name: "Category Results",
items: [{
item_id: "SKU_001",
item_name: "Product 1",
price: 29.99
}]
}
});
```
### 3. Product Detail View
```javascript
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "view_item",
ecommerce: {
currency: "USD",
value: 29.99,
items: [{
item_id: "SKU_001",
item_name: "Product 1",
item_brand: "Brand",
item_category: "Category",
price: 29.99,
quantity: 1
}]
}
});
```
### 4. Add to Cart
```javascript
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "add_to_cart",
ecommerce: {
currency: "USD",
value: 29.99,
items: [{
item_id: "SKU_001",
item_name: "Product 1",
price: 29.99,
quantity: 1
}]
}
});
```
### 5. View Cart
```javascript
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "view_cart",
ecommerce: {
currency: "USD",
value: 59.98,
items: [
{ item_id: "SKU_001", item_name: "Product 1", price: 29.99, quantity: 1 },
{ item_id: "SKU_002", item_name: "Product 2", price: 29.99, quantity: 1 }
]
}
});
```
### 6. Begin Checkout
```javascript
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "begin_checkout",
ecommerce: {
currency: "USD",
value: 59.98,
coupon: "DISCOUNT10",
items: [...]
}
});
```
### 7. Add Shipping Info
```javascript
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "add_shipping_info",
ecommerce: {
currency: "USD",
value: 59.98,
shipping_tier: "Standard",
items: [...]
}
});
```
### 8. Add Payment Info
```javascript
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "add_payment_info",
ecommerce: {
currency: "USD",
value: 59.98,
payment_type: "Credit Card",
items: [...]
}
});
```
### 9. Purchase
```javascript
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "purchase",
ecommerce: {
transaction_id: "T_12345",
value: 65.97,
tax: 4.99,
shipping: 5.99,
currency: "USD",
coupon: "DISCOUNT10",
items: [{
item_id: "SKU_001",
item_name: "Product 1",
affiliation: "Online Store",
coupon: "DISCOUNT10",
discount: 3.00,
item_brand: "Brand",
item_category: "Category",
price: 29.99,
quantity: 1
}]
}
});
```
## Korean E-commerce Considerations
### Currency
```javascript
currency: "KRW",
value: 35000 // No decimals for KRW
```
### Common Korean Platform Integrations
- Cafe24: Uses custom dataLayer structure
- Shopify Korea: Standard GA4 format
- Naver SmartStore: Custom pixel implementation