This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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\"},\" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {%- comment -%} theme.liquid, customer context bloğunun altına {%- endcomment -%} | |
| <script> | |
| (function () { | |
| function readConsent() { | |
| const cp = window.Shopify && window.Shopify.customerPrivacy; | |
| if (!cp || typeof cp.getVisitorConsent !== 'function') return null; | |
| const c = cp.getVisitorConsent(); | |
| return { | |
| _analytics_consent: c.analytics === true ? 'granted' : 'denied', | |
| _marketing_consent: c.marketing === true ? 'granted' : 'denied', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {%- 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 }} | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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. |
NewerOlder