URL Tracking Code Generator UI - Capability Audit¶
Audit Date: December 2024 Auditor: Automated Code Analysis Status: Ready for ~1 Week Implementation
Executive Summary¶
You have substantial existing infrastructure (estimated 70-80% reusable) for building a URL Tracking Code Generator UI. The affiliate tracking system provides UI patterns, the UTM infrastructure is well-documented, and the model layer already tracks UTM parameters. The gap is primarily a self-service UI for partners to generate tagged AWS Marketplace URLs.
Existing Infrastructure Assessment¶
1. UTM Tracking Backend - ✅ ROBUST¶
| Component | Location | Readiness |
|---|---|---|
| UTM Strategy Documentation | docs/cosell/analytics.md:272-282 |
✅ Complete |
| MarketplaceListingMetric Model | app/CustomExtensions/CloudMarketplace/.../MarketplaceListingMetric.php |
✅ Complete |
| DemoRequest UTM Capture | app/Http/Controllers/Demo/DemoRequestController.php:32-41 |
✅ Complete |
| Channel Attribution | MarketplaceListingMetric::CHANNELS (9 channels) |
✅ Complete |
UTM Fields Already Implemented:
// MarketplaceListingMetric model (lines 51-53)
'utm_campaign',
'utm_source',
'utm_medium',
// DemoRequest controller captures ALL 5 params (lines 35-40)
'utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'
Standardized UTM Schema (from docs/cosell/analytics.md):
utm_source: channel (linkedin, email, blog)
utm_medium: type (social, email, organic)
utm_campaign: campaign-name-quarter
utm_partner: partner-identifier
utm_content: asset-identifier
2. Affiliate Tracking UI - ✅ STRONG PATTERN¶
| Feature | Location | Reusability |
|---|---|---|
| Link Generation Display | resources/views/default/panel/user/affiliate/index.blade.php:32-51 |
✅ High |
| Copy-to-Clipboard Button | Same file, lines 44-50 | ✅ Direct reuse |
| JavaScript for Copying | public/themes/default/assets/js/panel/affiliate.js |
✅ Direct reuse |
| Form Input with URL Preview | Same view, line 39-43 | ✅ Adaptable |
Affiliate Link UI Pattern (reusable):
<x-forms.input
class="h-10 bg-background"
disabled
value="{{ url('/') . '/register?aff=' . Auth::user()->affiliate_code }}"
/>
<x-button class="copy-aff-link absolute end-0...">
<x-tabler-copy class="size-4" />
</x-button>
3. Marketplace Metrics Storage - ✅ COMPLETE¶
Database Schema (from migration 2025_11_30_000001):
- marketplace_listing_metrics table with UTM fields
- Channel comparison aggregation via getChannelComparison() method
- Lead funnel tracking (MQL/SQL/opportunities/closed_won)
- Revenue attribution
4. Livewire Component Pattern - ✅ AVAILABLE¶
Template Component: app/Livewire/Marketplace/LaunchReadinessScore.php
Key patterns to reuse:
- Listing selection dropdown
- Real-time calculation/generation
- Tab-based UI ($activeTab)
- Error handling ($error, $isScoring)
- Collection management ($listings)
What's Missing (Gap Analysis)¶
1. UI Component - NOT EXISTS¶
Effort: 3-4 days
Need to build: - Form inputs for UTM parameters (source, medium, campaign, partner, content) - AWS Marketplace base URL input or listing selector - Generated URL preview with copy button - URL history/saved links table
2. URL Generation Service - NOT EXISTS¶
Effort: 1 day
Need to build:
class UrlTrackingCodeService
{
public function generateTaggedUrl(
string $baseUrl,
array $utmParams,
?int $listingId = null
): string;
public function validateAwsMarketplaceUrl(string $url): bool;
public function saveGeneratedUrl(int $userId, string $url, array $params): void;
}
3. Generated URL History Model - NOT EXISTS¶
Effort: 0.5 days
Need to create:
// TrackedUrlCode model
- id
- user_id
- listing_id (nullable)
- base_url
- generated_url
- utm_source, utm_medium, utm_campaign, utm_partner, utm_content
- clicks (for optional analytics)
- created_at
4. Capability Registration - PARTIAL¶
Effort: 0.5 days
Can leverage CapabilityRegistry pattern for AI-assisted URL generation:
[
'slug' => 'generate_tracking_url',
'name' => 'Generate URL Tracking Code',
'category' => AgentCapability::CATEGORY_MARKETING,
'estimated_credits' => 0, // Free utility
]
Reusability Matrix¶
| Existing Code | Reuse For | Effort Saved |
|---|---|---|
| Affiliate link display UI | URL display with copy button | 80% |
affiliate.js clipboard logic |
Copy functionality | 100% |
LaunchReadinessScore Livewire |
Component structure/patterns | 70% |
| UTM validation in DemoRequest | Parameter validation | 100% |
MarketplaceListingMetric channels |
Source/medium dropdowns | 100% |
| Blade x-card, x-forms components | Form styling | 100% |
Implementation Recommendation¶
Option A: Minimal Viable Product (3-4 days)¶
Scope:
1. Create app/Livewire/Marketplace/UrlTrackingCodeGenerator.php
2. Create Blade view with:
- Dropdown for listing selection
- Form fields for UTM params
- Live URL preview
- Copy button (reuse affiliate.js)
3. Add route and menu item
Result: Functional URL generator without history/analytics
Option B: Full Feature (5-7 days)¶
Scope: Option A plus:
1. TrackedUrlCode model with migration
2. URL generation history table
3. Click tracking (optional)
4. Integration with MarketplaceListingMetric for attribution
Result: Complete tracking code management system
Suggested Architecture¶
app/
├── Livewire/
│ └── Marketplace/
│ └── UrlTrackingCodeGenerator.php # NEW
├── Services/
│ └── Marketing/
│ └── UrlTrackingCodeService.php # NEW
├── Models/
│ └── TrackedUrlCode.php # NEW (Option B)
resources/
└── views/
└── livewire/
└── marketplace/
└── url-tracking-code-generator.blade.php # NEW
Menu Location Recommendation¶
Based on existing structure:
Marketplace Readiness (existing menu)
├── Readiness Checklist (existing)
├── Compliance Reports (existing)
└── URL Tracking Codes (NEW) ← Add here
Or under Marketing Dashboard if treating as broader GTM tool.
Effort Summary¶
| Task | Effort | Dependencies |
|---|---|---|
| Livewire Component | 2 days | None |
| Blade View | 1 day | Component |
| URL Service | 0.5 days | None |
| Route + Menu | 0.5 days | View |
| Total Option A | 4 days | |
| Migration + Model | 0.5 days | None |
| History UI | 1 day | Model |
| Click Tracking | 1 day | Model |
| Total Option B | 6.5 days |
Conclusion¶
Your codebase is 70-80% ready for this feature:
| Aspect | Readiness |
|---|---|
| UTM Standards | ✅ Defined and documented |
| Backend Storage | ✅ MarketplaceListingMetric supports UTM |
| UI Patterns | ✅ Affiliate UI is directly reusable |
| Component Patterns | ✅ LaunchReadinessScore is good template |
| Validation | ✅ DemoRequestController has UTM validation |
| JavaScript | ✅ Clipboard functionality exists |
| Missing | UI + Service + optional history |
Estimated total effort: 1 week aligns with your audit document's assessment.
File References¶
| Component | Path |
|---|---|
| UTM Documentation | docs/cosell/analytics.md:272-282 |
| MarketplaceListingMetric | app/CustomExtensions/CloudMarketplace/System/Models/MarketplaceListingMetric.php |
| Affiliate UI Pattern | resources/views/default/panel/user/affiliate/index.blade.php |
| Affiliate JS | public/themes/default/assets/js/panel/affiliate.js |
| DemoRequest UTM | app/Http/Controllers/Demo/DemoRequestController.php:32-41 |
| Livewire Pattern | app/Livewire/Marketplace/LaunchReadinessScore.php |
| CapabilityRegistry | app/Extensions/ContentManager/System/Services/AgentCore/CapabilityRegistry.php |
| Seller Prime Audit | docs/AWS_MARKETPLACE_SELLER_PRIME_COMPLIANCE_AUDIT.md |