Skip to content

Instantly share code, notes, and snippets.

View ceaksan's full-sized avatar
🤹

Ceyhun Aksan ceaksan

🤹
View GitHub Profile
@ceaksan
ceaksan / shopify_market_bridge.js
Created April 17, 2026 20:38
Shopify Market Bridge - Consent-Gated Market Cookie Writer. Pairs with storageHelper and custom pixel to bridge Liquid localization data into the Shopify pixel sandbox.
/**
* Shopify Market Bridge - Consent-Gated Market Cookie Writer
*
* Theme app extension (app embed) snippet that reads Liquid localization
* data from <script id="shopify-market-data"> and writes it to a cookie
* that the custom pixel sandbox can read via browser.cookie.get().
*
* Requires storageHelper utility: https://gist.github.com/ceaksan/26c8a59aa8a518732a9a40da967d8cd2
*
* Consent gate: Shopify.customerPrivacy.analyticsProcessingAllowed()
@ceaksan
ceaksan / gtm-umami-purchase-bridge.js
Created April 14, 2026 16:39
GTM Custom HTML Tag: Send purchase event data + first-party cookie attribution (dnm_src/dnm_cid) to Umami via umami.track(). Cookie-less attribution debugging alongside GA4.
/**
* GTM Custom HTML Tag — Umami purchase event bridge
* File: gtm-umami-purchase-bridge.js
*
* What it does:
* Sends purchase event data + first-party cookie attribution
* to Umami via umami.track(). Runs alongside GA4 purchase tag
* to create an independent, cookie-less attribution record.
*
* Parameters sent to Umami:
@ceaksan
ceaksan / gtm-page-location-transaction-id.js
Created April 14, 2026 16:00
GTM Custom JS Variable: Append ecommerce transaction_id to page_location for order-level debugging in GA4 Explore reports. Platform-agnostic (T-Soft, Shopify, Ticimax, WooCommerce).
/**
* GTM Custom JavaScript Variable — page_location + transaction_id
* File: gtm-page-location-transaction-id.js
*
* What it does:
* Appends the ecommerce transaction ID to the current page URL.
* Used as a page_location override in GA4 purchase tags to enable
* order-level debugging in Explore reports.
*
* Example output:
@ceaksan
ceaksan / gist-dnm-debug.js
Created April 14, 2026 15:33
DNM Attribution: Browser console debug script — Displays dnm_src/dnm_cid cookie status, dataLayer push history, and test URL examples. Paste in console or append ?dnm_debug=1 to any page.
/**
* DNM Attribution — Browser console debug script
* File: dnm-debug.js
*
* Usage:
* 1. Open browser console (F12 → Console)
* 2. Paste this script and run it
* 3. Or append ?dnm_debug=1 to any URL (purchase enrichment logs automatically)
*
* Test scenario URLs:
@ceaksan
ceaksan / gist-purchase-enrichment.js
Last active April 14, 2026 15:46
GTM Custom HTML: Purchase source enrichment — Reads dnm_src/dnm_cid via storageHelper (cookie-first, localStorage fallback) at purchase, pushes first_touch_source/medium/campaign/click_id to dataLayer as GA4 event-scope custom dimensions. Does NOT affect attribution model. Requires storageHelper companion gist.
/**
* GTM Custom HTML Tag — Purchase source enrichment
* File: gtm-purchase-enrichment.js
*
* What it does:
* When a purchase event fires, reads dnm_src / dnm_cid via storageHelper
* and pushes custom event parameters to dataLayer for the GA4
* purchase tag to pick up.
*
* Requires:
@ceaksan
ceaksan / gist-source-capture.js
Last active April 14, 2026 15:46
GTM Custom HTML: First-touch source capture — Reads UTM/gclid/fbclid from landing URL, writes to dnm_src and dnm_cid via storageHelper (cookie + localStorage dual-write). Overwrites only on new click ID. Requires storageHelper companion gist.
/**
* GTM Custom HTML Tag — First-touch source capture
* File: gtm-source-capture.js
*
* What it does:
* Reads utm_*, gclid, fbclid parameters from the landing URL
* and writes them to two storage keys via storageHelper:
* "dnm_src" and "dnm_cid".
*
* Requires:
@ceaksan
ceaksan / gist-spoke4-decision-gate.md
Created April 9, 2026 06:40
Decision Gate Checklist + Destructive Command Guard for Claude Code

Decision Gate Checklist

Evaluate every new dependency, pattern, API, or architectural decision against these 8 criteria.

Criteria

Criterion Question Red Flag
Benefit What concrete problem does it solve? Measurable impact? "Might need it later", "because it's best practice"
Necessity What happens if we don't? Is there a simpler alternative? Adding something new when existing solution is sufficient
@ceaksan
ceaksan / gist-spoke3-instinct-schema.json
Created April 9, 2026 06:40
Claude Code Learning Pipeline: Architecture Overview + Instinct JSON Schema
{
"$schema": "Instinct JSON Schema — Claude Code Learning Pipeline",
"description": "Schema for mature-instincts.json and global-instincts.json files used by the learning pipeline.",
"raw_capture_record": {
"description": "Written by passive-learner.py (PostToolUse hook) to instincts.jsonl",
"example": {
"ts": "2026-04-07T10:15:00Z",
"project": "my-project",
"pattern": "missing-import",
@ceaksan
ceaksan / gist-spoke2-coffee-analyze.py
Created April 9, 2026 06:40
Coffee Debt: Gamified AI Error Tracking for Claude Code (tracker + analyzer)
#!/usr/bin/env python3
"""Coffee Analysis CLI — Analyze AI mistake patterns from coffee-log.jsonl.
Usage:
python3 coffee-analyze.py # 7-day summary
python3 coffee-analyze.py --days 30 # 30-day lookback
python3 coffee-analyze.py --format json # JSON output
Data source: ~/.claude/coffee-log.jsonl (produced by coffee-tracker.sh hook)
Debt file: ~/.claude/coffee-debt (cumulative bean count)
@ceaksan
ceaksan / gist-spoke1-context-hygiene-checklist.md
Created April 9, 2026 06:40
Claude Code Context Hygiene Checklist + SHARED_TASK_NOTES.md Template

Context Hygiene Checklist for Claude Code

Compaction Awareness

  • Autocompact triggers based on default 200K context window (~167K tokens after buffer)
  • Only 5 most recent files + ~50K summary survive compaction
  • NEVER rely on "I mentioned earlier" after 50+ tool calls — re-read source files
  • Before final steps of a long task: re-read critical files
  • After compaction, reasoning chains and intermediate Read results are lost