Skip to content

Instantly share code, notes, and snippets.

View ceaksan's full-sized avatar
🤹

Ceyhun Aksan ceaksan

🤹
View GitHub Profile
@ceaksan
ceaksan / ollama-setup.sh
Created April 27, 2026 19:38
Ollama + Qwen2.5-Coder setup for privacy-friendly pivot pipeline. Companion to https://ceaksan.com/en/pivot-table-data-analytics-and-ai-integration
#!/usr/bin/env bash
#
# Ollama + Qwen2.5-Coder setup script for a privacy-friendly pivot pipeline.
# Source: https://ceaksan.com/en/pivot-table-data-analytics-and-ai-integration
#
# What it does:
# 1. Installs the Ollama daemon (macOS / Linux)
# 2. Pulls Qwen2.5-Coder (size picked from available memory: 7B / 14B / 32B)
# 3. Creates a Python venv with minimal deps
# 4. Smoke test: produces a one-sentence insight from a tiny pivot summary
@ceaksan
ceaksan / B2B Free Gift Auto-Attach.flow
Last active April 24, 2026 15:23
Shopify Flow — B2B Koşullu Hediye Bundle (Tester Signal Setter + Free Gift Auto-Attach). Blog: https://ceaksan.com/tr/shopify-flow-b2b-hediye-otomasyon/
1d17a3adb482f8211eeb7e07fa9fb08ea3ca8c8802284d47f90ecbd5a008bd52:{"__metadata":{"version":0.1},"root":{"steps":[{"step_id":"b06b4e8d-f172-4cc4-92db-0ce72959af9e","step_position":[560,0],"config_field_values":[],"task_id":"shopify::admin::order_paid","task_version":"0.1","task_type":"TRIGGER","description":null,"note":null,"name":null},{"step_id":"73dec430-68ac-420d-997d-6dcd1f3b3754","step_position":[560,180],"config_field_values":[{"config_field_id":"condition","value":"{\"uuid\":\"01KPX2J8SSKBG73SCQ4CBYWF95\",\"lhs\":{\"uuid\":\"01KPX2J8SSY0QQQPDH6H0CQXAN\",\"parent_uuid\":\"01KPX2J8SSKBG73SCQ4CBYWF95\",\"lhs\":{\"uuid\":\"01KPX2J8SSE2GEQG9AX18XQ1W3\",\"parent_uuid\":\"01KPX2J8SSY0QQQPDH6H0CQXAN\",\"value\":\"order.customer.b2bStatus.value\",\"comparison_value_type\":\"EnvironmentValue\",\"full_environment_path\":\"order.customer.b2bStatus.value\"},\"rhs\":{\"uuid\":\"01KPX2J8SSYQV1M9HRBTNWA8HS\",\"parent_uuid\":\"01KPX2J8SSY0QQQPDH6H0CQXAN\",\"value\":\"true\",\"comparison_value_type\":\"LiteralValue\"},\"
@ceaksan
ceaksan / theme-liquid-consent-sync.liquid
Last active April 23, 2026 07:48
Shopify theme.liquid — Shopify.customerPrivacy state -> cart attribute consent snapshot sync
@ceaksan
ceaksan / shopify-custom-pixel-attribute-reader.js
Created April 23, 2026 07:40
Shopify custom pixel — reading cart attributes from init and event payloads, dataLayer enrichment
// Customer events > Add custom pixel
analytics.subscribe("page_viewed", (event) => {
const initAttrs =
(init && init.data && init.data.cart && init.data.cart.attributes) || [];
const b2b = getAttr(initAttrs, "_b2b") === "true";
const customerId = getAttr(initAttrs, "_customer_id");
// GA4 user_property olarak dataLayer'a push
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
@ceaksan
ceaksan / theme-liquid-customer-context.liquid
Last active April 24, 2026 15:24
Shopify theme.liquid — customer metafield -> cart attribute sync (B2B, consent, customer_id)
{%- comment -%} theme.liquid — head sonuna yakın, Shopify.analytics yüklendikten sonra {%- endcomment -%}
{% if customer %}
<script>
(async function syncCustomerContext() {
try {
const desired = {
_b2b: {{ customer.b2b? | default: customer.metafields.custom.b2b_status.value | default: false | json }},
_customer_id: {{ customer.id | json }},
_customer_tags: {{ customer.tags | join: ',' | json }}
};
@ceaksan
ceaksan / cart_abandonment_beacon_server.py
Created April 17, 2026 20:39
Cart Abandonment Beacon Server (pseudo-code) - heartbeat/visibility handler that schedules abandonment checks on silence.
"""
Cart Abandonment - Beacon Server (Pseudo-code)
Server-side handler for the beacon client
(https://gist.github.com/ceaksan/cart_abandonment_beacon_client.js).
Maintains per-session state and schedules an abandonment check after
each heartbeat. If no heartbeat arrives within the grace window
(e.g. 30 minutes) and no purchase has been recorded, an abandonment
is triggered.
@ceaksan
ceaksan / cart_abandonment_beacon_client.js
Created April 17, 2026 20:39
Cart Abandonment Beacon Client - navigator.sendBeacon heartbeat client for server-side cart abandonment detection.
/**
* Cart Abandonment - Beacon Client
*
* Server-side cart abandonment detector (client half). Emits beacons
* for page_enter, periodic heartbeat, tab_hidden, tab_visible and
* purchase_complete events so that a backend can decide abandonment
* based on heartbeat silence (e.g. 30 minutes without heartbeat +
* no purchase => abandonment).
*
* Pairs with the server-side handler:
@ceaksan
ceaksan / cart_abandonment_state_machine.js
Created April 17, 2026 20:39
Cart Abandonment State Machine - funnel-aware client-side abandonment detector with grace period, BFCache support and cross-tab sync.
/**
* Cart Abandonment State Machine
*
* Funnel-aware client-side cart abandonment detector. Distinguishes
* real abandonment (cart -> homepage, cart -> blog, cart -> exit)
* from normal in-funnel behavior (cart -> product, cart -> checkout).
*
* Features:
* - Regex-based strict path matching per URL type
* - Grace period to swallow fast re-entries (e.g. cart -> product -> cart)
@ceaksan
ceaksan / shopify_custom_pixel_multimarket.js
Created April 17, 2026 20:38
Shopify Custom Pixel - Multi-Market GA4 and Google Ads tracking with market-specific measurement and conversion IDs.
/**
* Shopify Custom Pixel - Multi-Market GA4 & Google Ads Tracking
*
* Routes Shopify Customer Events to market-specific GA4 measurement IDs
* and Google Ads conversion IDs based on the market cookie written by
* the market bridge (for storefront events) and the native localization
* object (for checkout events).
*
* Install via: Shopify Admin > Settings > Customer Events > Add custom pixel.
*
@ceaksan
ceaksan / shopify_pixel_market_events.js
Created April 17, 2026 20:38
Shopify Custom Pixel - Market-Aware Event Enrichment via cookie bridge.
/**
* Shopify Custom Pixel - Market-Aware Event Enrichment
*
* Reads the market cookie written by the market bridge (shopify_market_bridge.js)
* from the pixel sandbox via browser.cookie.get() and enriches
* storefront events. For checkout events, Shopify's native
* event.data.checkout.localization object is used as the authoritative source,
* and the cookie value is used for cross-validation.
*
* Drop this code into Shopify Admin > Settings > Customer Events > Custom Pixel.