@akson/cortex-analytics 0.8.0 → 0.8.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/README.md CHANGED
@@ -1,89 +1,14 @@
1
1
  # @akson/cortex-analytics
2
2
 
3
- Command-line interface for unified analytics management across Google Tag Manager, Google Ads, PostHog, and Google Search Console platforms.
4
-
5
- ## User Stories
6
-
7
- ### Unified Analytics Management Stories
8
-
9
- **As a Marketing Operations Manager**, I want to manage all analytics platforms from a single CLI, so that I can streamline operations without switching between multiple tools.
10
-
11
- **As a DevOps Engineer**, I want to integrate analytics management into CI/CD pipelines, so that I can automate tracking deployment alongside application releases.
12
-
13
- **As a Digital Marketing Director**, I want to perform health checks across all analytics platforms, so that I can ensure data integrity and tracking reliability.
14
-
15
- **As a Data Engineer**, I want to export data from multiple analytics platforms simultaneously, so that I can create unified reporting dashboards.
16
-
17
- ### Platform Health Monitoring Stories
18
-
19
- **As a Site Reliability Engineer**, I want automated health checks for all analytics platforms, so that I can detect issues before they impact data collection.
20
-
21
- **As a Marketing Technology Manager**, I want real-time status monitoring of GTM, Google Ads, PostHog, and GSC, so that I can ensure continuous data flow.
22
-
23
- **As a Quality Assurance Manager**, I want comprehensive validation reports across platforms, so that I can verify tracking implementation accuracy.
24
-
25
- **As a Marketing Analyst**, I want to monitor data freshness and completeness, so that I can ensure reports reflect current performance.
26
-
27
- ### Campaign Management Stories
28
-
29
- **As a Performance Marketing Manager**, I want to launch campaigns across multiple platforms from one interface, so that I can coordinate multi-channel campaigns efficiently.
30
-
31
- **As a Campaign Manager**, I want to update tracking parameters across platforms simultaneously, so that I can maintain attribution consistency during campaign launches.
32
-
33
- **As a Growth Marketing Manager**, I want automated campaign optimization suggestions from all platforms, so that I can improve performance through unified insights.
34
-
35
- **As a Marketing Operations Specialist**, I want bulk campaign configuration updates, so that I can implement changes at scale across client accounts.
36
-
37
- ### Data Integration & Analysis Stories
38
-
39
- **As a Business Intelligence Analyst**, I want to correlate data across GTM, Google Ads, PostHog, and GSC, so that I can understand complete customer journeys.
40
-
41
- **As a Marketing Analyst**, I want unified conversion attribution across platforms, so that I can measure true marketing effectiveness.
42
-
43
- **As a Data Scientist**, I want programmatic access to all analytics data, so that I can build predictive models and advanced analytics.
44
-
45
- **As a Marketing Director**, I want executive dashboards combining all platform data, so that I can understand overall marketing performance.
46
-
47
- ### Automation & Workflow Stories
48
-
49
- **As a Marketing Automation Engineer**, I want to create workflows that respond to changes across platforms, so that I can implement dynamic optimization strategies.
50
-
51
- **As a Marketing Technology Lead**, I want scheduled reports combining insights from all platforms, so that I can provide regular stakeholder updates.
52
-
53
- **As a Performance Marketing Director**, I want automated alerting when metrics deviate across platforms, so that I can respond to issues proactively.
54
-
55
- **As a Digital Marketing Manager**, I want template-based campaign deployment across platforms, so that I can standardize campaign implementation.
56
-
57
- ### Multi-Client Management Stories
58
-
59
- **As an Agency Owner**, I want to manage analytics for multiple client accounts from one interface, so that I can scale operations efficiently.
60
-
61
- **As a Marketing Consultant**, I want comparative analytics across client accounts, so that I can identify best practices and optimization opportunities.
62
-
63
- **As an Account Manager**, I want client-specific dashboards and reports, so that I can provide tailored insights without manual data manipulation.
64
-
65
- **As a Marketing Services Director**, I want bulk operations across multiple client accounts, so that I can implement changes at agency scale.
66
-
67
- ### Troubleshooting & Support Stories
68
-
69
- **As a Technical Support Manager**, I want diagnostic tools for analytics implementation issues, so that I can resolve client problems quickly.
70
-
71
- **As a Marketing Operations Analyst**, I want detailed error reporting across platforms, so that I can identify and fix tracking issues systematically.
72
-
73
- **As a Customer Success Manager**, I want health reports for client analytics setups, so that I can proactively address implementation issues.
74
-
75
- **As a Quality Assurance Engineer**, I want validation tools for tracking implementations, so that I can ensure client setups meet standards.
3
+ Unified CLI for Cortex analytics operations across Google Tag Manager, Google Ads, PostHog, and Google Search Console platforms.
76
4
 
77
5
  ## Features
78
6
 
79
- - **Unified Platform Management**: Control GTM, Google Ads, PostHog, and GSC from one CLI
80
- - **Health Monitoring**: Comprehensive health checks across all platforms
81
- - **Automated Reporting**: Generate unified reports combining data from all sources
82
- - **Campaign Coordination**: Launch and manage campaigns across multiple platforms
83
- - **Data Validation**: Verify tracking accuracy and data quality
84
- - **Real-time Monitoring**: Live status updates and alerting
85
- - **Multi-Client Support**: Manage multiple accounts and clients efficiently
86
- - **CI/CD Integration**: Automation-friendly for DevOps workflows
7
+ - 🎯 **Unified CLI** - Manage multiple analytics platforms from one interface
8
+ - 📊 **Health Monitoring** - Check platform status and performance
9
+ - 🔧 **Configuration Management** - Centralized platform configuration
10
+ - 📈 **Reporting** - Generate unified reports across platforms
11
+ - **Automation** - CI/CD integration and bulk operations
87
12
 
88
13
  ## Installation
89
14
 
@@ -91,687 +16,31 @@ Command-line interface for unified analytics management across Google Tag Manage
91
16
  npm install -g @akson/cortex-analytics
92
17
  ```
93
18
 
94
- ## Quick Start
95
-
96
- ```bash
97
- # Initialize configuration
98
- akson-analytics init
99
-
100
- # Run health check across all platforms
101
- akson-analytics health
102
-
103
- # Generate unified performance report
104
- akson-analytics report --period last-30-days
105
-
106
- # Monitor real-time status
107
- akson-analytics monitor --watch
108
-
109
- # Deploy campaign tracking
110
- akson-analytics campaign deploy --config campaign-config.json
111
- ```
112
-
113
- ## GTM Setup Guide
114
-
115
- ### Prerequisites
116
-
117
- 1. **Service Account Setup**:
118
-
119
- ```json
120
- {
121
- "type": "service_account",
122
- "project_id": "your-project",
123
- "private_key_id": "...",
124
- "private_key": "...",
125
- "client_email": "gtm-automation@your-project.iam.gserviceaccount.com"
126
- }
127
- ```
128
-
129
- 2. **GTM Permissions**: Grant Editor access to GTM container
130
-
131
- 3. **Configuration File** (`gtm.config.yaml`):
132
-
133
- ```yaml
134
- container_id: "GTM-T8WRBMWV"
135
- workspace_id: 40 # Default workspace
136
- google_ads_customer_id: "659644670"
137
-
138
- # Tags with firing triggers
139
- tags:
140
- - name: "GA4 Configuration"
141
- type: "googtag"
142
- firing_triggers:
143
- - "All Pages"
144
- parameters:
145
- - key: "tagId"
146
- value: "G-PTZF5JDTMH"
147
-
148
- - name: "Google Ads - Form Submission"
149
- type: "awct"
150
- firing_triggers:
151
- - "Form Submission - Lead"
152
- parameters:
153
- - key: "conversionId"
154
- value: "8847935674"
155
- - key: "conversionLabel"
156
- value: "JIHLCN-r-IwbEP7BxboC"
157
-
158
- # Required triggers
159
- triggers:
160
- - name: "All Pages"
161
- type: "pageview"
162
- - name: "Form Submission - Lead"
163
- type: "customEvent"
164
- custom_event_filter:
165
- - type: "equals"
166
- parameter:
167
- - key: "arg0"
168
- value: "{{_event}}"
169
- - key: "arg1"
170
- value: "lead_form_submitted"
171
- ```
172
-
173
- ### Quick Setup Commands
174
-
175
- ```bash
176
- # 1. Initialize GTM workspace
177
- npx @akson/cortex-analytics gtm init --config gtm.config.yaml
178
-
179
- # 2. Deploy configuration (creates all resources)
180
- npx @akson/cortex-analytics gtm apply --config gtm.config.yaml --yes
181
-
182
- # 3. Verify deployment
183
- npx @akson/cortex-analytics gtm verify
184
-
185
- # 4. Publish to production (optional)
186
- npx @akson/cortex-analytics gtm version-create --name "Production Deploy v1.0"
187
- npx @akson/cortex-analytics gtm publish --version-id 123
188
- ```
189
-
190
- ### Firing Triggers Management
191
-
192
- The CLI automatically handles firing trigger assignments:
193
-
194
- ```bash
195
- # Fix missing firing triggers on existing tags
196
- node scripts/gtm-sync/fix-all-firing-triggers.js
197
-
198
- # Complete configuration sync with verification
199
- node scripts/gtm-sync/enhanced-gtm-sync.js
200
-
201
- # Test firing triggers API functionality
202
- node scripts/tests/test-firing-triggers-api.js
203
- ```
204
-
205
- **Key Features**:
206
-
207
- - ✅ Automatic trigger name → ID resolution
208
- - ✅ Idempotent operations (safe to re-run)
209
- - ✅ State verification and compliance checking
210
- - ✅ Comprehensive error handling
211
-
212
- ### Common Issues & Solutions
213
-
214
- **Missing Firing Triggers**:
215
-
216
- ```bash
217
- # Diagnosis
218
- npx @akson/cortex-analytics gtm query --type tags
219
-
220
- # Fix
221
- node scripts/gtm-sync/fix-all-firing-triggers.js
222
- ```
223
-
224
- **Configuration Validation Errors**:
225
-
226
- ```bash
227
- # Validate YAML syntax and references
228
- npx @akson/cortex-analytics gtm validate --config gtm.config.yaml
229
- ```
230
-
231
- **API Authentication Issues**:
232
-
233
- ```bash
234
- # Test authentication
235
- npx @akson/cortex-analytics gtm query --type workspaces
236
- ```
237
-
238
- ## Commands
239
-
240
- ### Configuration
241
-
242
- #### `init`
243
-
244
- Initialize CLI configuration and authentication.
245
-
246
- ```bash
247
- # Interactive setup
248
- akson-analytics init
249
-
250
- # Initialize with config file
251
- akson-analytics init --config analytics-config.json
252
-
253
- # Setup for specific platforms
254
- akson-analytics init --platforms gtm,google-ads,posthog
255
- ```
256
-
257
- #### `config`
258
-
259
- Manage configuration settings.
260
-
261
- ```bash
262
- # Show current configuration
263
- akson-analytics config show
264
-
265
- # Set configuration value
266
- akson-analytics config set gtm.container-id GTM-XXXXXXX
267
-
268
- # List all available settings
269
- akson-analytics config list
270
-
271
- # Validate configuration
272
- akson-analytics config validate
273
- ```
274
-
275
- ### Health Monitoring
276
-
277
- #### `health`
278
-
279
- Perform comprehensive health checks across platforms.
280
-
281
- ```bash
282
- # Check all platforms
283
- akson-analytics health
284
-
285
- # Check specific platforms
286
- akson-analytics health --platforms gtm,posthog
287
-
288
- # Detailed health report
289
- akson-analytics health --verbose
290
-
291
- # Output as JSON
292
- akson-analytics health --format json
293
-
294
- # Check with specific thresholds
295
- akson-analytics health --thresholds thresholds.json
296
- ```
297
-
298
- #### `monitor`
299
-
300
- Real-time monitoring with live updates.
301
-
302
- ```bash
303
- # Start monitoring dashboard
304
- akson-analytics monitor
305
-
306
- # Monitor with refresh interval
307
- akson-analytics monitor --interval 30s
308
-
309
- # Watch for specific issues
310
- akson-analytics monitor --alerts-only
311
-
312
- # Monitor specific metrics
313
- akson-analytics monitor --metrics "gtm.tags,ads.conversions"
314
-
315
- # Save monitoring data
316
- akson-analytics monitor --output monitoring-data.json
317
- ```
318
-
319
- ### Reporting
320
-
321
- #### `report`
322
-
323
- Generate unified analytics reports.
324
-
325
- ```bash
326
- # Generate standard performance report
327
- akson-analytics report
328
-
329
- # Report for specific time period
330
- akson-analytics report --period last-7-days
331
- akson-analytics report --from 2025-01-01 --to 2025-01-31
332
-
333
- # Platform-specific reports
334
- akson-analytics report --platforms gtm,google-ads
335
-
336
- # Custom report formats
337
- akson-analytics report --format pdf
338
- akson-analytics report --template executive-summary
339
-
340
- # Automated report scheduling
341
- akson-analytics report --schedule daily --email team@company.com
342
- ```
343
-
344
- #### `dashboard`
345
-
346
- Interactive analytics dashboard.
347
-
348
- ```bash
349
- # Launch interactive dashboard
350
- akson-analytics dashboard
351
-
352
- # Dashboard for specific platforms
353
- akson-analytics dashboard --platforms gtm,posthog
354
-
355
- # Client-specific dashboard
356
- akson-analytics dashboard --client client-123
357
-
358
- # Export dashboard data
359
- akson-analytics dashboard --export dashboard-data.json
360
- ```
361
-
362
- ### Campaign Management
363
-
364
- #### `campaign`
365
-
366
- Manage campaigns across platforms.
367
-
368
- ```bash
369
- # List all campaigns
370
- akson-analytics campaign list
371
-
372
- # Deploy new campaign configuration
373
- akson-analytics campaign deploy --config new-campaign.json
374
-
375
- # Update existing campaigns
376
- akson-analytics campaign update --campaign-id "campaign-123" --budget 1000
377
-
378
- # Campaign performance analysis
379
- akson-analytics campaign analyze --campaign-id "campaign-123"
380
-
381
- # Bulk campaign operations
382
- akson-analytics campaign bulk-update --file campaigns-update.csv
383
- ```
384
-
385
- #### `conversion`
386
-
387
- Manage conversion tracking across platforms.
388
-
389
- ```bash
390
- # List conversion actions
391
- akson-analytics conversion list
392
-
393
- # Create new conversion tracking
394
- akson-analytics conversion create --name "Email Signup" --value 10
395
-
396
- # Upload conversion data
397
- akson-analytics conversion upload --file conversions.csv
398
-
399
- # Validate conversion tracking
400
- akson-analytics conversion validate
401
- ```
402
-
403
- ### Data Management
404
-
405
- #### `export`
406
-
407
- Export data from multiple platforms.
408
-
409
- ```bash
410
- # Export all platform data
411
- akson-analytics export --period last-30-days
412
-
413
- # Export specific platform data
414
- akson-analytics export --platform gtm --output gtm-data.json
415
-
416
- # Export with custom queries
417
- akson-analytics export --query-file custom-queries.json
418
-
419
- # Scheduled exports
420
- akson-analytics export --schedule daily --destination s3://bucket/path
421
- ```
422
-
423
- #### `sync`
424
-
425
- Synchronize data between platforms.
426
-
427
- ```bash
428
- # Sync conversion data between platforms
429
- akson-analytics sync conversions
430
-
431
- # Sync audience data
432
- akson-analytics sync audiences --from posthog --to google-ads
433
-
434
- # Sync campaign configurations
435
- akson-analytics sync campaigns --template master-template.json
436
-
437
- # Real-time sync monitoring
438
- akson-analytics sync monitor --watch
439
- ```
440
-
441
- ### Validation & Testing
442
-
443
- #### `validate`
444
-
445
- Validate tracking implementations.
446
-
447
- ```bash
448
- # Validate all platform configurations
449
- akson-analytics validate
450
-
451
- # Validate specific implementations
452
- akson-analytics validate --type gtm-tags
453
-
454
- # Validate against schema
455
- akson-analytics validate --schema validation-schema.json
456
-
457
- # Generate validation report
458
- akson-analytics validate --report validation-report.html
459
- ```
460
-
461
- #### `test`
462
-
463
- Test analytics implementations.
464
-
465
- ```bash
466
- # Run test suite across platforms
467
- akson-analytics test
468
-
469
- # Test specific scenarios
470
- akson-analytics test --scenario conversion-tracking
471
-
472
- # Load testing for high-volume events
473
- akson-analytics test --load --events 1000
474
-
475
- # Test with sample data
476
- akson-analytics test --sample-data test-events.json
477
- ```
478
-
479
- ## Configuration Files
480
-
481
- ### Main Configuration (`analytics-config.json`)
482
-
483
- ```json
484
- {
485
- "platforms": {
486
- "gtm": {
487
- "accountId": "6005256287",
488
- "containerId": "226061083",
489
- "serviceAccount": {
490
- "keyFile": "path/to/gtm-service-account.json",
491
- "email": "gtm-automation@project.iam.gserviceaccount.com"
492
- }
493
- },
494
- "googleAds": {
495
- "customerId": "659-644-670",
496
- "developerToken": "your-developer-token",
497
- "serviceAccount": {
498
- "keyFile": "path/to/ads-service-account.json",
499
- "email": "ads-automation@project.iam.gserviceaccount.com"
500
- }
501
- },
502
- "postHog": {
503
- "apiKey": "phc_Y8vb3DFiRumtKXyoKQsVO77XlE26AuDWc1iXaZc8rjC",
504
- "projectId": "105629",
505
- "host": "https://us.i.posthog.com"
506
- },
507
- "gsc": {
508
- "siteUrl": "https://myarmy.swiss",
509
- "serviceAccount": {
510
- "keyFile": "path/to/gsc-service-account.json",
511
- "email": "gsc-automation@project.iam.gserviceaccount.com"
512
- }
513
- }
514
- },
515
- "monitoring": {
516
- "healthCheckInterval": "5m",
517
- "alertThresholds": {
518
- "conversionRate": 0.02,
519
- "errorRate": 0.01,
520
- "dataFreshness": "1h"
521
- }
522
- },
523
- "reporting": {
524
- "defaultPeriod": "last-30-days",
525
- "timezone": "UTC",
526
- "formats": ["json", "csv", "html"]
527
- }
528
- }
529
- ```
530
-
531
- ### Campaign Configuration (`campaign-config.json`)
532
-
533
- ```json
534
- {
535
- "name": "Q1 2025 Growth Campaign",
536
- "platforms": {
537
- "gtm": {
538
- "variables": [
539
- {
540
- "name": "Campaign ID",
541
- "type": "constant",
542
- "value": "q1-2025-growth"
543
- }
544
- ],
545
- "tags": [
546
- {
547
- "name": "Campaign Conversion Tag",
548
- "type": "gaawe",
549
- "conversionId": "AW-659644670",
550
- "conversionLabel": "JIHLCN-r-IwbEP7BxboC"
551
- }
552
- ]
553
- },
554
- "googleAds": {
555
- "campaigns": [
556
- {
557
- "name": "Q1 Growth - Search",
558
- "type": "SEARCH",
559
- "budget": 1000,
560
- "bidding": "TARGET_CPA",
561
- "targetCpa": 50
562
- }
563
- ]
564
- },
565
- "postHog": {
566
- "events": ["campaign_view", "campaign_conversion"],
567
- "properties": {
568
- "campaign_id": "q1-2025-growth",
569
- "campaign_source": "google-ads"
570
- }
571
- }
572
- }
573
- }
574
- ```
575
-
576
- ### Health Check Thresholds (`thresholds.json`)
577
-
578
- ```json
579
- {
580
- "gtm": {
581
- "publishedVersionAge": "7d",
582
- "tagErrorRate": 0.01,
583
- "triggerFireRate": 0.95
584
- },
585
- "googleAds": {
586
- "accountStatus": "ENABLED",
587
- "campaignStatus": "ENABLED",
588
- "conversionTrackingStatus": "ACTIVE",
589
- "minimumConversions": 1
590
- },
591
- "postHog": {
592
- "eventIngestionDelay": "5m",
593
- "dailyEventVolume": 1000,
594
- "apiResponseTime": "2s"
595
- },
596
- "gsc": {
597
- "dataFreshness": "24h",
598
- "crawlErrorCount": 5,
599
- "indexingIssues": 3
600
- }
601
- }
602
- ```
603
-
604
- ## Usage Examples
605
-
606
- ### Daily Operations Workflow
607
-
608
- ```bash
609
- # Morning routine: Check platform health
610
- akson-analytics health --verbose
611
-
612
- # Generate daily performance report
613
- akson-analytics report --period yesterday --format html --email team@company.com
614
-
615
- # Monitor campaign performance
616
- akson-analytics campaign analyze --active-only
617
-
618
- # Check for any tracking issues
619
- akson-analytics validate --quick-check
620
- ```
621
-
622
- ### Campaign Launch Workflow
623
-
624
- ```bash
625
- # 1. Validate campaign configuration
626
- akson-analytics campaign validate --config new-campaign.json
627
-
628
- # 2. Deploy tracking infrastructure
629
- akson-analytics campaign deploy --config new-campaign.json --dry-run
630
- akson-analytics campaign deploy --config new-campaign.json
631
-
632
- # 3. Verify deployment
633
- akson-analytics validate --campaign new-campaign
634
- akson-analytics test --scenario new-campaign
635
-
636
- # 4. Start monitoring
637
- akson-analytics monitor --campaign new-campaign --alerts-only
638
- ```
639
-
640
- ### Multi-Client Agency Workflow
641
-
642
- ```bash
643
- # Generate reports for all clients
644
- for client in $(akson-analytics config clients list); do
645
- akson-analytics report --client $client --format pdf --output "reports/${client}-report.pdf"
646
- done
647
-
648
- # Health check across all client accounts
649
- akson-analytics health --all-clients --summary
19
+ ## Usage
650
20
 
651
- # Bulk update across clients
652
- akson-analytics campaign bulk-update --file client-updates.csv --all-clients
653
- ```
654
-
655
- ### Data Export and Analysis Workflow
21
+ ### CLI Commands
656
22
 
657
23
  ```bash
658
- # Export last month's data from all platforms
659
- akson-analytics export --period last-month --all-platforms --format csv
660
-
661
- # Generate unified conversion report
662
- akson-analytics report --type conversions --platforms gtm,google-ads,posthog
663
-
664
- # Sync audience data from PostHog to Google Ads
665
- akson-analytics sync audiences --from posthog --to google-ads --type high-value-users
666
-
667
- # Validate data consistency across platforms
668
- akson-analytics validate --type data-consistency --platforms all
669
- ```
670
-
671
- ### Continuous Integration Workflow
672
-
673
- ```bash
674
- #!/bin/bash
675
- # CI/CD integration script
676
-
677
- # Pre-deployment validation
678
- akson-analytics validate --strict --config production-config.json
679
-
680
- if [ $? -eq 0 ]; then
681
- # Deploy tracking changes
682
- akson-analytics campaign deploy --config deployment-config.json
683
-
684
- # Verify deployment
685
- sleep 60 # Allow propagation time
686
- akson-analytics test --scenario post-deployment
687
-
688
- # Start monitoring
689
- akson-analytics monitor --alerts-only --duration 1h &
690
-
691
- echo "Analytics deployment completed successfully"
692
- else
693
- echo "Analytics validation failed - aborting deployment"
694
- exit 1
695
- fi
696
- ```
697
-
698
- ## Advanced Features
699
-
700
- ### Custom Plugins
701
-
702
- Create custom analytics plugins:
703
-
704
- ```typescript
705
- // plugins/custom-analytics.ts
706
- import { AnalyticsPlugin } from "@akson/cortex-analytics";
707
-
708
- export class CustomAnalyticsPlugin extends AnalyticsPlugin {
709
- name = "custom-analytics";
710
-
711
- async healthCheck() {
712
- // Custom health check logic
713
- return { status: "healthy", metrics: {} };
714
- }
715
-
716
- async exportData(options: ExportOptions) {
717
- // Custom data export logic
718
- return { data: [], format: "json" };
719
- }
720
- }
721
- ```
722
-
723
- ### Webhook Integrations
724
-
725
- Set up webhook notifications:
726
-
727
- ```bash
728
- # Configure webhook for health alerts
729
- akson-analytics config set webhooks.health.url https://api.slack.com/webhooks/xxx
730
- akson-analytics config set webhooks.health.events "error,warning"
731
-
732
- # Configure webhook for campaign events
733
- akson-analytics config set webhooks.campaigns.url https://api.teams.com/webhooks/yyy
734
- akson-analytics config set webhooks.campaigns.events "launch,complete,budget_exceeded"
735
- ```
24
+ # Initialize configuration
25
+ cortex-analytics init
736
26
 
737
- ### Custom Dashboards
27
+ # Check platform health
28
+ cortex-analytics health
738
29
 
739
- Create custom dashboard configurations:
30
+ # Generate reports
31
+ cortex-analytics report --period last-30-days
740
32
 
741
- ```json
742
- // dashboards/executive-dashboard.json
743
- {
744
- "name": "Executive Dashboard",
745
- "widgets": [
746
- {
747
- "type": "kpi",
748
- "metric": "total_conversions",
749
- "platforms": ["gtm", "google-ads", "posthog"]
750
- },
751
- {
752
- "type": "trend",
753
- "metric": "conversion_rate",
754
- "period": "last-30-days",
755
- "breakdown": "platform"
756
- },
757
- {
758
- "type": "funnel",
759
- "events": ["page_view", "form_start", "form_complete", "purchase"],
760
- "platform": "posthog"
761
- }
762
- ]
763
- }
33
+ # Monitor platforms
34
+ cortex-analytics monitor
764
35
  ```
765
36
 
766
- ## API Integration
767
-
768
- Use programmatically in Node.js applications:
37
+ ### Programmatic Usage
769
38
 
770
39
  ```typescript
771
- import { AnalyticsManager } from "@akson/cortex-analytics";
40
+ import { AnalyticsManager } from '@akson/cortex-analytics';
772
41
 
773
42
  const analytics = new AnalyticsManager({
774
- configFile: "analytics-config.json",
43
+ configFile: 'analytics-config.json',
775
44
  });
776
45
 
777
46
  // Perform health check
@@ -779,92 +48,65 @@ const health = await analytics.healthCheck();
779
48
 
780
49
  // Generate report
781
50
  const report = await analytics.generateReport({
782
- period: "last-30-days",
783
- platforms: ["gtm", "google-ads", "posthog"],
784
- format: "json",
785
- });
786
-
787
- // Monitor in real-time
788
- analytics.monitor({
789
- interval: 30000,
790
- onAlert: (alert) => {
791
- console.log("Alert:", alert);
792
- },
51
+ period: 'last-30-days',
52
+ platforms: ['gtm', 'google-ads', 'posthog'],
793
53
  });
794
54
  ```
795
55
 
796
- ## Output Formats
56
+ ## Configuration
797
57
 
798
- ### JSON Output
58
+ Create an `analytics-config.json` file:
799
59
 
800
60
  ```json
801
61
  {
802
- "timestamp": "2025-01-27T10:30:00Z",
803
- "status": "healthy",
804
62
  "platforms": {
805
63
  "gtm": {
806
- "status": "healthy",
807
- "lastCheck": "2025-01-27T10:29:45Z",
808
- "metrics": {
809
- "tagsActive": 15,
810
- "triggersActive": 8,
811
- "publishedVersionAge": "2d"
812
- }
64
+ "accountId": "your-account-id",
65
+ "containerId": "your-container-id"
66
+ },
67
+ "googleAds": {
68
+ "customerId": "your-customer-id"
69
+ },
70
+ "postHog": {
71
+ "apiKey": "your-api-key",
72
+ "projectId": "your-project-id"
73
+ },
74
+ "gsc": {
75
+ "siteUrl": "https://your-site.com"
813
76
  }
814
77
  }
815
78
  }
816
79
  ```
817
80
 
818
- ### HTML Report Output
81
+ ## Supported Platforms
819
82
 
820
- - Executive summary with key insights
821
- - Platform-specific performance charts
822
- - Trend analysis and recommendations
823
- - Interactive data visualizations
824
- - Printable format for stakeholder sharing
83
+ - **Google Tag Manager** - Tag and trigger management
84
+ - **Google Ads** - Campaign and conversion tracking
85
+ - **PostHog** - Event analytics and user insights
86
+ - **Google Search Console** - Search performance monitoring
825
87
 
826
- ### CSV Export Format
88
+ ## Version History
827
89
 
828
- ```csv
829
- date,platform,metric,value,change_pct
830
- 2025-01-27,gtm,tags_fired,1247,+12.3
831
- 2025-01-27,google-ads,conversions,89,+8.7
832
- 2025-01-27,posthog,events,15678,+15.2
833
- ```
90
+ - **0.8.0** - Current version with unified CLI
91
+ - **0.7.x** - Platform integration improvements
92
+ - **0.6.x** - Initial release
834
93
 
835
- ## Error Handling
94
+ ## Dependencies
836
95
 
837
- The CLI provides comprehensive error handling:
96
+ This package integrates with several Cortex platform packages:
97
+ - `@akson/cortex-google-ads`
98
+ - `@akson/cortex-gsc`
99
+ - `@akson/cortex-gtm`
100
+ - `@akson/cortex-posthog`
838
101
 
839
- ```bash
840
- # Verbose error output
841
- akson-analytics health --verbose
102
+ ## Contributing
842
103
 
843
- # Debug mode for troubleshooting
844
- akson-analytics health --debug
845
-
846
- # Validate configuration before operations
847
- akson-analytics config validate
848
-
849
- # Test connections before main operations
850
- akson-analytics test connections
851
- ```
852
-
853
- ## Performance Optimization
854
-
855
- - **Parallel Processing**: Commands run platform operations in parallel
856
- - **Caching**: Intelligent caching reduces API calls and improves response times
857
- - **Rate Limiting**: Built-in rate limiting prevents API quota exhaustion
858
- - **Incremental Updates**: Only update changed configurations
859
- - **Batch Operations**: Bulk operations for improved efficiency
860
-
861
- ## Requirements
862
-
863
- - Node.js ≥18.0.0
864
- - Valid API credentials for enabled platforms
865
- - Sufficient API quota for planned operations
866
- - Network access to platform APIs
104
+ Part of the Cortex packages ecosystem. Contributions welcome!
867
105
 
868
106
  ## License
869
107
 
870
108
  MIT
109
+
110
+ ## Support
111
+
112
+ For support, please open an issue in the [Cortex Packages repository](https://github.com/antoineschaller/cortex-packages).