optbrew 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +6 -0
- package/.claude-plugin/plugin.json +6 -0
- package/.codex-plugin/plugin.json +13 -0
- package/CHANGELOG.md +20 -0
- package/LICENSE +21 -0
- package/README.ko.md +73 -0
- package/README.md +72 -2
- package/THIRD_PARTY_NOTICES.md +10 -0
- package/bin/optbrew.mjs +4 -0
- package/docs/platforms.md +31 -0
- package/docs/release.md +14 -0
- package/lib/cli.mjs +103 -0
- package/lib/doctor.mjs +44 -0
- package/lib/install.mjs +158 -0
- package/lib/paths.mjs +30 -0
- package/lib/records.mjs +44 -0
- package/lib/transaction.mjs +205 -0
- package/lib/update.mjs +181 -0
- package/package.json +39 -4
- package/plugin.json +13 -0
- package/skills/optbrew/LICENSE +21 -0
- package/skills/optbrew/SKILL.md +17 -0
- package/skills/optbrew/THIRD_PARTY_NOTICES.md +10 -0
- package/skills/optbrew/agents/openai.yaml +4 -0
- package/skills/optbrew/bundle-manifest.json +663 -0
- package/skills/optbrew/licenses/firecrawl-seo-audit.txt +15 -0
- package/skills/optbrew/licenses/magnus-seo.txt +21 -0
- package/skills/optbrew/licenses/marketing-search.txt +21 -0
- package/skills/optbrew/licenses/mblode-seo.txt +21 -0
- package/skills/optbrew/licenses/naver-searchadvisor.txt +29 -0
- package/skills/optbrew/licenses/seranking-seo.txt +21 -0
- package/skills/optbrew/modules/firecrawl-seo-audit/GUIDE.md +64 -0
- package/skills/optbrew/modules/magnus-seo/GUIDE.md +79 -0
- package/skills/optbrew/modules/magnus-seo/README.md +45 -0
- package/skills/optbrew/modules/magnus-seo/assets/audit-report-template.md +76 -0
- package/skills/optbrew/modules/magnus-seo/references/aeo-methodology.md +105 -0
- package/skills/optbrew/modules/magnus-seo/references/agent-readable-content.md +28 -0
- package/skills/optbrew/modules/magnus-seo/references/content-and-entity-architecture.md +100 -0
- package/skills/optbrew/modules/magnus-seo/references/content-strategy-seo.md +142 -0
- package/skills/optbrew/modules/magnus-seo/references/discovery-and-freshness.md +47 -0
- package/skills/optbrew/modules/magnus-seo/references/evidence-boundaries.md +75 -0
- package/skills/optbrew/modules/magnus-seo/references/ghost-metadata.md +204 -0
- package/skills/optbrew/modules/magnus-seo/references/implementation-playbook.md +114 -0
- package/skills/optbrew/modules/magnus-seo/references/measurement-and-experimentation.md +47 -0
- package/skills/optbrew/modules/magnus-seo/references/onpage-seo.md +154 -0
- package/skills/optbrew/modules/magnus-seo/references/platform-guidance.md +30 -0
- package/skills/optbrew/modules/magnus-seo/references/schema-markup.md +244 -0
- package/skills/optbrew/modules/magnus-seo/references/source-index.md +36 -0
- package/skills/optbrew/modules/magnus-seo/references/structured-data.md +56 -0
- package/skills/optbrew/modules/magnus-seo/references/technical-seo.md +99 -0
- package/skills/optbrew/modules/magnus-seo/scripts/aeo_audit.py +158 -0
- package/skills/optbrew/modules/magnus-seo/scripts/build_prompt_matrix.py +52 -0
- package/skills/optbrew/modules/magnus-seo/templates/aeo-implementation-plan.md +53 -0
- package/skills/optbrew/modules/magnus-seo/templates/citation-observation-log.md +16 -0
- package/skills/optbrew/modules/magnus-seo/templates/llms.txt.template +15 -0
- package/skills/optbrew/modules/magnus-seo/templates/question-cluster.md +27 -0
- package/skills/optbrew/modules/magnus-seo/templates/robots-ai-crawlers.txt +23 -0
- package/skills/optbrew/modules/marketing-search/skills/ai-seo/GUIDE.md +483 -0
- package/skills/optbrew/modules/marketing-search/skills/ai-seo/references/agent-readiness.md +57 -0
- package/skills/optbrew/modules/marketing-search/skills/ai-seo/references/citations-vs-recommendations.md +85 -0
- package/skills/optbrew/modules/marketing-search/skills/ai-seo/references/content-patterns.md +287 -0
- package/skills/optbrew/modules/marketing-search/skills/ai-seo/references/content-types.md +71 -0
- package/skills/optbrew/modules/marketing-search/skills/ai-seo/references/format-volatility.md +98 -0
- package/skills/optbrew/modules/marketing-search/skills/ai-seo/references/okf.md +104 -0
- package/skills/optbrew/modules/marketing-search/skills/ai-seo/references/platform-ranking-factors.md +154 -0
- package/skills/optbrew/modules/marketing-search/skills/ai-seo/references/youtube-ai-citations.md +60 -0
- package/skills/optbrew/modules/marketing-search/skills/analytics/GUIDE.md +303 -0
- package/skills/optbrew/modules/marketing-search/skills/analytics/references/event-library.md +260 -0
- package/skills/optbrew/modules/marketing-search/skills/analytics/references/ga4-implementation.md +300 -0
- package/skills/optbrew/modules/marketing-search/skills/analytics/references/gtm-implementation.md +390 -0
- package/skills/optbrew/modules/marketing-search/skills/content-strategy/GUIDE.md +432 -0
- package/skills/optbrew/modules/marketing-search/skills/content-strategy/references/content-distribution.md +83 -0
- package/skills/optbrew/modules/marketing-search/skills/content-strategy/references/headless-cms.md +194 -0
- package/skills/optbrew/modules/marketing-search/skills/programmatic-seo/GUIDE.md +231 -0
- package/skills/optbrew/modules/marketing-search/skills/programmatic-seo/references/playbooks.md +308 -0
- package/skills/optbrew/modules/marketing-search/skills/schema/GUIDE.md +172 -0
- package/skills/optbrew/modules/marketing-search/skills/schema/references/schema-examples.md +398 -0
- package/skills/optbrew/modules/marketing-search/skills/seo-audit/GUIDE.md +492 -0
- package/skills/optbrew/modules/marketing-search/skills/seo-audit/references/ai-writing-detection.md +200 -0
- package/skills/optbrew/modules/marketing-search/skills/seo-audit/references/international-seo.md +230 -0
- package/skills/optbrew/modules/marketing-search/skills/site-architecture/GUIDE.md +350 -0
- package/skills/optbrew/modules/marketing-search/skills/site-architecture/references/mermaid-templates.md +216 -0
- package/skills/optbrew/modules/marketing-search/skills/site-architecture/references/navigation-patterns.md +305 -0
- package/skills/optbrew/modules/marketing-search/skills/site-architecture/references/site-type-templates.md +293 -0
- package/skills/optbrew/modules/mblode-seo/GUIDE.md +74 -0
- package/skills/optbrew/modules/mblode-seo/references/answer-engines.md +58 -0
- package/skills/optbrew/modules/mblode-seo/references/audit.md +78 -0
- package/skills/optbrew/modules/mblode-seo/references/brief-template.md +47 -0
- package/skills/optbrew/modules/mblode-seo/references/monitoring.md +56 -0
- package/skills/optbrew/modules/mblode-seo/references/nextjs-implementation.md +65 -0
- package/skills/optbrew/modules/mblode-seo/references/research-protocol.md +37 -0
- package/skills/optbrew/modules/mblode-seo/references/sources.md +47 -0
- package/skills/optbrew/modules/mblode-seo/references/validation-evidence.md +21 -0
- package/skills/optbrew/modules/naver-searchadvisor/GUIDE.md +75 -0
- package/skills/optbrew/modules/naver-searchadvisor/NOTICE.md +59 -0
- package/skills/optbrew/modules/naver-searchadvisor/references/INDEX.md +97 -0
- package/skills/optbrew/modules/naver-searchadvisor/scripts/audit.mjs +714 -0
- package/skills/optbrew/modules/naver-searchadvisor/scripts/robots.mjs +77 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-ai-search-share-of-voice/GUIDE.md +94 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-api/GUIDE.md +186 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-api/references/api-surface-map.md +207 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-api/references/auth-and-keys.md +182 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-api/references/integration-patterns.md +283 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-api/references/rate-limits-and-credits.md +235 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-competitor-gap-analysis/GUIDE.md +117 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-content-audit/GUIDE.md +155 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-content-audit/references/cite.md +84 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-content-audit/references/core-eeat.md +147 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-content-audit/templates/verdict.md +63 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-firecrawl/GUIDE.md +141 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-firecrawl/references/preflight.md +73 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-geo/GUIDE.md +159 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/GUIDE.md +393 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/assets/templates/cwv-audit-report.md +48 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/assets/templates/gsc-performance-report.md +44 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/assets/templates/indexation-status-report.md +43 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/references/auth-setup.md +160 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/references/cross-skill-integration.md +187 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/references/ga4-data-api.md +184 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/references/indexing-api.md +109 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/references/keyword-planner-api.md +66 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/references/nlp-api.md +55 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/references/pagespeed-crux-api.md +204 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/references/rate-limits-quotas.md +75 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/references/search-console-api.md +156 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/references/supplementary-apis.md +99 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-google/references/youtube-api.md +49 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-keyword-niche/GUIDE.md +174 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-page/GUIDE.md +174 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-plan/GUIDE.md +220 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-schema/GUIDE.md +135 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-schema/references/google-rich-results.md +89 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-schema/templates/article.json +23 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-schema/templates/breadcrumb-list.json +18 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-schema/templates/faq-page.json +22 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-schema/templates/local-business.json +32 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-schema/templates/product.json +25 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-sitemap/GUIDE.md +128 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-technical-audit/GUIDE.md +235 -0
- package/skills/optbrew/modules/seranking-seo/skills/seo-technical-audit/references/severity-mapping.md +133 -0
- package/skills/optbrew/references/api.md +45 -0
- package/skills/optbrew/references/check-registry.json +28 -0
- package/skills/optbrew/references/evidence.md +9 -0
- package/skills/optbrew/references/intake.md +9 -0
- package/skills/optbrew/references/measurement.md +29 -0
- package/skills/optbrew/references/policies.md +7 -0
- package/skills/optbrew/references/profiles.json +13 -0
- package/skills/optbrew/references/remediations.json +12 -0
- package/skills/optbrew/references/report.md +25 -0
- package/skills/optbrew/references/routing.md +15 -0
- package/skills/optbrew/references/schemas/contract.schema.json +51 -0
- package/skills/optbrew/references/scoring.md +62 -0
- package/skills/optbrew/scripts/adapters/anthropic.mjs +116 -0
- package/skills/optbrew/scripts/adapters/imports.mjs +81 -0
- package/skills/optbrew/scripts/audit.mjs +145 -0
- package/skills/optbrew/scripts/cli.mjs +41 -0
- package/skills/optbrew/scripts/core/bootstrap.mjs +31 -0
- package/skills/optbrew/scripts/core/bundle.mjs +73 -0
- package/skills/optbrew/scripts/core/capabilities.mjs +19 -0
- package/skills/optbrew/scripts/core/collector.mjs +236 -0
- package/skills/optbrew/scripts/core/compare.mjs +47 -0
- package/skills/optbrew/scripts/core/contracts.mjs +144 -0
- package/skills/optbrew/scripts/core/cost-ledger.mjs +95 -0
- package/skills/optbrew/scripts/core/findings.mjs +54 -0
- package/skills/optbrew/scripts/core/metrics.mjs +97 -0
- package/skills/optbrew/scripts/core/protocol.mjs +125 -0
- package/skills/optbrew/scripts/core/report.mjs +652 -0
- package/skills/optbrew/scripts/core/scope.mjs +52 -0
- package/skills/optbrew/scripts/core/score.mjs +71 -0
- package/skills/optbrew/scripts/core/weights.mjs +139 -0
- package/skills/optbrew/source-lock.json +2686 -0
- package/source-lock.json +2686 -0
package/skills/optbrew/modules/marketing-search/skills/analytics/references/gtm-implementation.md
ADDED
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
# Google Tag Manager Implementation Reference
|
|
2
|
+
|
|
3
|
+
Detailed guide for implementing tracking via Google Tag Manager.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
- Container Structure (tags, triggers, variables)
|
|
7
|
+
- Naming Conventions
|
|
8
|
+
- Data Layer Patterns
|
|
9
|
+
- Common Tag Configurations (GA4 configuration tag, GA4 event tag, Facebook pixel)
|
|
10
|
+
- Preview and Debug
|
|
11
|
+
- Workspaces and Versioning
|
|
12
|
+
- Consent Management
|
|
13
|
+
- Advanced Patterns (tag sequencing, exception handling, custom JavaScript variables)
|
|
14
|
+
|
|
15
|
+
## Container Structure
|
|
16
|
+
|
|
17
|
+
### Tags
|
|
18
|
+
|
|
19
|
+
Tags are code snippets that execute when triggered.
|
|
20
|
+
|
|
21
|
+
**Common tag types:**
|
|
22
|
+
- GA4 Configuration (base setup)
|
|
23
|
+
- GA4 Event (custom events)
|
|
24
|
+
- Google Ads Conversion
|
|
25
|
+
- Facebook Pixel
|
|
26
|
+
- LinkedIn Insight Tag
|
|
27
|
+
- Custom HTML (for other pixels)
|
|
28
|
+
|
|
29
|
+
### Triggers
|
|
30
|
+
|
|
31
|
+
Triggers define when tags fire.
|
|
32
|
+
|
|
33
|
+
**Built-in triggers:**
|
|
34
|
+
- Page View: All Pages, DOM Ready, Window Loaded
|
|
35
|
+
- Click: All Elements, Just Links
|
|
36
|
+
- Form Submission
|
|
37
|
+
- Scroll Depth
|
|
38
|
+
- Timer
|
|
39
|
+
- Element Visibility
|
|
40
|
+
|
|
41
|
+
**Custom triggers:**
|
|
42
|
+
- Custom Event (from dataLayer)
|
|
43
|
+
- Trigger Groups (multiple conditions)
|
|
44
|
+
|
|
45
|
+
### Variables
|
|
46
|
+
|
|
47
|
+
Variables capture dynamic values.
|
|
48
|
+
|
|
49
|
+
**Built-in (enable as needed):**
|
|
50
|
+
- Click Text, Click URL, Click ID, Click Classes
|
|
51
|
+
- Page Path, Page URL, Page Hostname
|
|
52
|
+
- Referrer
|
|
53
|
+
- Form Element, Form ID
|
|
54
|
+
|
|
55
|
+
**User-defined:**
|
|
56
|
+
- Data Layer variables
|
|
57
|
+
- JavaScript variables
|
|
58
|
+
- Lookup tables
|
|
59
|
+
- RegEx tables
|
|
60
|
+
- Constants
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Naming Conventions
|
|
65
|
+
|
|
66
|
+
### Recommended Format
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
[Type] - [Description] - [Detail]
|
|
70
|
+
|
|
71
|
+
Tags:
|
|
72
|
+
GA4 - Event - Signup Completed
|
|
73
|
+
GA4 - Config - Base Configuration
|
|
74
|
+
FB - Pixel - Page View
|
|
75
|
+
HTML - LiveChat Widget
|
|
76
|
+
|
|
77
|
+
Triggers:
|
|
78
|
+
Click - CTA Button
|
|
79
|
+
Submit - Contact Form
|
|
80
|
+
View - Pricing Page
|
|
81
|
+
Custom - signup_completed
|
|
82
|
+
|
|
83
|
+
Variables:
|
|
84
|
+
DL - user_id
|
|
85
|
+
JS - Current Timestamp
|
|
86
|
+
LT - Campaign Source Map
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Data Layer Patterns
|
|
92
|
+
|
|
93
|
+
### Basic Structure
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
// Initialize (in <head> before GTM)
|
|
97
|
+
window.dataLayer = window.dataLayer || [];
|
|
98
|
+
|
|
99
|
+
// Push event
|
|
100
|
+
dataLayer.push({
|
|
101
|
+
'event': 'event_name',
|
|
102
|
+
'property1': 'value1',
|
|
103
|
+
'property2': 'value2'
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Page Load Data
|
|
108
|
+
|
|
109
|
+
```javascript
|
|
110
|
+
// Set on page load (before GTM container)
|
|
111
|
+
window.dataLayer = window.dataLayer || [];
|
|
112
|
+
dataLayer.push({
|
|
113
|
+
'pageType': 'product',
|
|
114
|
+
'contentGroup': 'products',
|
|
115
|
+
'user': {
|
|
116
|
+
'loggedIn': true,
|
|
117
|
+
'userId': '12345',
|
|
118
|
+
'userType': 'premium'
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Form Submission
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
document.querySelector('#contact-form').addEventListener('submit', function() {
|
|
127
|
+
dataLayer.push({
|
|
128
|
+
'event': 'form_submitted',
|
|
129
|
+
'formName': 'contact',
|
|
130
|
+
'formLocation': 'footer'
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Button Click
|
|
136
|
+
|
|
137
|
+
```javascript
|
|
138
|
+
document.querySelector('.cta-button').addEventListener('click', function() {
|
|
139
|
+
dataLayer.push({
|
|
140
|
+
'event': 'cta_clicked',
|
|
141
|
+
'ctaText': this.innerText,
|
|
142
|
+
'ctaLocation': 'hero'
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### E-commerce Events
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
// Product view
|
|
151
|
+
dataLayer.push({ ecommerce: null }); // Clear previous
|
|
152
|
+
dataLayer.push({
|
|
153
|
+
'event': 'view_item',
|
|
154
|
+
'ecommerce': {
|
|
155
|
+
'items': [{
|
|
156
|
+
'item_id': 'SKU123',
|
|
157
|
+
'item_name': 'Product Name',
|
|
158
|
+
'price': 99.99,
|
|
159
|
+
'item_category': 'Category',
|
|
160
|
+
'quantity': 1
|
|
161
|
+
}]
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// Add to cart
|
|
166
|
+
dataLayer.push({ ecommerce: null });
|
|
167
|
+
dataLayer.push({
|
|
168
|
+
'event': 'add_to_cart',
|
|
169
|
+
'ecommerce': {
|
|
170
|
+
'items': [{
|
|
171
|
+
'item_id': 'SKU123',
|
|
172
|
+
'item_name': 'Product Name',
|
|
173
|
+
'price': 99.99,
|
|
174
|
+
'quantity': 1
|
|
175
|
+
}]
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Purchase
|
|
180
|
+
dataLayer.push({ ecommerce: null });
|
|
181
|
+
dataLayer.push({
|
|
182
|
+
'event': 'purchase',
|
|
183
|
+
'ecommerce': {
|
|
184
|
+
'transaction_id': 'T12345',
|
|
185
|
+
'value': 99.99,
|
|
186
|
+
'currency': 'USD',
|
|
187
|
+
'tax': 5.00,
|
|
188
|
+
'shipping': 10.00,
|
|
189
|
+
'items': [{
|
|
190
|
+
'item_id': 'SKU123',
|
|
191
|
+
'item_name': 'Product Name',
|
|
192
|
+
'price': 99.99,
|
|
193
|
+
'quantity': 1
|
|
194
|
+
}]
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Common Tag Configurations
|
|
202
|
+
|
|
203
|
+
### GA4 Configuration Tag
|
|
204
|
+
|
|
205
|
+
**Tag Type:** Google Analytics: GA4 Configuration
|
|
206
|
+
|
|
207
|
+
**Settings:**
|
|
208
|
+
- Measurement ID: G-XXXXXXXX
|
|
209
|
+
- Send page view: Checked (for pageviews)
|
|
210
|
+
- User Properties: Add any user-level dimensions
|
|
211
|
+
|
|
212
|
+
**Trigger:** All Pages
|
|
213
|
+
|
|
214
|
+
### GA4 Event Tag
|
|
215
|
+
|
|
216
|
+
**Tag Type:** Google Analytics: GA4 Event
|
|
217
|
+
|
|
218
|
+
**Settings:**
|
|
219
|
+
- Configuration Tag: Select your config tag
|
|
220
|
+
- Event Name: {{DL - event_name}} or hardcode
|
|
221
|
+
- Event Parameters: Add parameters from dataLayer
|
|
222
|
+
|
|
223
|
+
**Trigger:** Custom Event with event name match
|
|
224
|
+
|
|
225
|
+
### Facebook Pixel - Base
|
|
226
|
+
|
|
227
|
+
**Tag Type:** Custom HTML
|
|
228
|
+
|
|
229
|
+
```html
|
|
230
|
+
<script>
|
|
231
|
+
!function(f,b,e,v,n,t,s)
|
|
232
|
+
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
|
233
|
+
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
|
234
|
+
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
|
|
235
|
+
n.queue=[];t=b.createElement(e);t.async=!0;
|
|
236
|
+
t.src=v;s=b.getElementsByTagName(e)[0];
|
|
237
|
+
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
|
238
|
+
'https://connect.facebook.net/en_US/fbevents.js');
|
|
239
|
+
fbq('init', 'YOUR_PIXEL_ID');
|
|
240
|
+
fbq('track', 'PageView');
|
|
241
|
+
</script>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Trigger:** All Pages
|
|
245
|
+
|
|
246
|
+
### Facebook Pixel - Event
|
|
247
|
+
|
|
248
|
+
**Tag Type:** Custom HTML
|
|
249
|
+
|
|
250
|
+
```html
|
|
251
|
+
<script>
|
|
252
|
+
fbq('track', 'Lead', {
|
|
253
|
+
content_name: '{{DL - form_name}}'
|
|
254
|
+
});
|
|
255
|
+
</script>
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Trigger:** Custom Event - form_submitted
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Preview and Debug
|
|
263
|
+
|
|
264
|
+
### Preview Mode
|
|
265
|
+
|
|
266
|
+
1. Click "Preview" in GTM
|
|
267
|
+
2. Enter site URL
|
|
268
|
+
3. GTM debug panel opens at bottom
|
|
269
|
+
|
|
270
|
+
**What to check:**
|
|
271
|
+
- Tags fired on this event
|
|
272
|
+
- Tags not fired (and why)
|
|
273
|
+
- Variables and their values
|
|
274
|
+
- Data layer contents
|
|
275
|
+
|
|
276
|
+
### Debug Tips
|
|
277
|
+
|
|
278
|
+
**Tag not firing:**
|
|
279
|
+
- Check trigger conditions
|
|
280
|
+
- Verify data layer push
|
|
281
|
+
- Check tag sequencing
|
|
282
|
+
|
|
283
|
+
**Wrong variable value:**
|
|
284
|
+
- Check data layer structure
|
|
285
|
+
- Verify variable path (nested objects)
|
|
286
|
+
- Check timing (data may not exist yet)
|
|
287
|
+
|
|
288
|
+
**Multiple firings:**
|
|
289
|
+
- Check trigger uniqueness
|
|
290
|
+
- Look for duplicate tags
|
|
291
|
+
- Check tag firing options
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Workspaces and Versioning
|
|
296
|
+
|
|
297
|
+
### Workspaces
|
|
298
|
+
|
|
299
|
+
Use workspaces for team collaboration:
|
|
300
|
+
- Default workspace for production
|
|
301
|
+
- Separate workspaces for large changes
|
|
302
|
+
- Merge when ready
|
|
303
|
+
|
|
304
|
+
### Version Management
|
|
305
|
+
|
|
306
|
+
**Best practices:**
|
|
307
|
+
- Name every version descriptively
|
|
308
|
+
- Add notes explaining changes
|
|
309
|
+
- Review changes before publish
|
|
310
|
+
- Keep production version noted
|
|
311
|
+
|
|
312
|
+
**Version notes example:**
|
|
313
|
+
```
|
|
314
|
+
v15: Added purchase conversion tracking
|
|
315
|
+
- New tag: GA4 - Event - Purchase
|
|
316
|
+
- New trigger: Custom Event - purchase
|
|
317
|
+
- New variables: DL - transaction_id, DL - value
|
|
318
|
+
- Tested: Chrome, Safari, Mobile
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Consent Management
|
|
324
|
+
|
|
325
|
+
### Consent Mode Integration
|
|
326
|
+
|
|
327
|
+
```javascript
|
|
328
|
+
// Default state (before consent)
|
|
329
|
+
gtag('consent', 'default', {
|
|
330
|
+
'analytics_storage': 'denied',
|
|
331
|
+
'ad_storage': 'denied'
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
// Update on consent
|
|
335
|
+
function grantConsent() {
|
|
336
|
+
gtag('consent', 'update', {
|
|
337
|
+
'analytics_storage': 'granted',
|
|
338
|
+
'ad_storage': 'granted'
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### GTM Consent Overview
|
|
344
|
+
|
|
345
|
+
1. Enable Consent Overview in Admin
|
|
346
|
+
2. Configure consent for each tag
|
|
347
|
+
3. Tags respect consent state automatically
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Advanced Patterns
|
|
352
|
+
|
|
353
|
+
### Tag Sequencing
|
|
354
|
+
|
|
355
|
+
**Setup tags to fire in order:**
|
|
356
|
+
Tag Configuration > Advanced Settings > Tag Sequencing
|
|
357
|
+
|
|
358
|
+
**Use cases:**
|
|
359
|
+
- Config tag before event tags
|
|
360
|
+
- Pixel initialization before tracking
|
|
361
|
+
- Cleanup after conversion
|
|
362
|
+
|
|
363
|
+
### Exception Handling
|
|
364
|
+
|
|
365
|
+
**Trigger exceptions** - Prevent tag from firing:
|
|
366
|
+
- Exclude certain pages
|
|
367
|
+
- Exclude internal traffic
|
|
368
|
+
- Exclude during testing
|
|
369
|
+
|
|
370
|
+
### Custom JavaScript Variables
|
|
371
|
+
|
|
372
|
+
```javascript
|
|
373
|
+
// Get URL parameter
|
|
374
|
+
function() {
|
|
375
|
+
var params = new URLSearchParams(window.location.search);
|
|
376
|
+
return params.get('campaign') || '(not set)';
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// Get cookie value
|
|
380
|
+
function() {
|
|
381
|
+
var match = document.cookie.match('(^|;) ?user_id=([^;]*)(;|$)');
|
|
382
|
+
return match ? match[2] : null;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// Get data from page
|
|
386
|
+
function() {
|
|
387
|
+
var el = document.querySelector('.product-price');
|
|
388
|
+
return el ? parseFloat(el.textContent.replace('$', '')) : 0;
|
|
389
|
+
}
|
|
390
|
+
```
|