{
  "name": "Browsing Time Logger",
  "description": "Counts how often you land on each website as you browse, keeping a private per-host tally in the Data Store — no account, no tracking off-device.",
  "tags": [
    "time tracking",
    "browsing",
    "monitor",
    "privacy",
    "analytics",
    "habits"
  ],
  "type": "triggered",
  "nodes": [
    {
      "id": "sticky-intro",
      "position": {
        "x": 20,
        "y": 20
      },
      "data": {
        "color": "#fff266",
        "content": "📊 See where your browsing goes.\n\nEvery time a tab finishes navigating, this reads the page's hostname and bumps a private per-site counter in the Data Store. Everything stays on your device. Open the workflow's Data Store any time to see the tallies. Tip: use the Data Store 'list' operation in a separate run to review counts."
      },
      "type": "stickyNote",
      "width": 360,
      "height": 200
    },
    {
      "id": "trigger-nav",
      "position": {
        "x": 120,
        "y": 320
      },
      "data": {
        "instance": {
          "id": "af-base-node:trigger:navigationTrigger"
        },
        "label": "On page navigation",
        "inputs": {
          "urlPatterns": [
            "<all_urls>"
          ],
          "events": [
            "updated"
          ]
        },
        "parameters": {
          "notes": "Fires whenever a tab finishes navigating. Its output includes the page url."
        }
      },
      "type": "trigger"
    },
    {
      "id": "extract-host",
      "position": {
        "x": 440,
        "y": 320
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:code"
        },
        "label": "Get the hostname",
        "inputs": {
          "code": "from urllib.parse import urlparse\nu = input.get('url', '') if isinstance(input, dict) else ''\nhost = ''\ntry:\n    host = urlparse(str(u)).netloc\nexcept Exception:\n    host = ''\nif not host:\n    host = 'unknown'\n{'host': host, 'url': u}"
        },
        "parameters": {
          "notes": "Python: extracts the hostname (e.g. news.ycombinator.com) from the page url. The last line is the result."
        }
      },
      "type": "basic"
    },
    {
      "id": "increment-host",
      "position": {
        "x": 760,
        "y": 320
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:dataStore"
        },
        "label": "Count this visit",
        "inputs": {
          "operation": "increment",
          "scope": "workflow",
          "key": "{{ $input.result.host }}",
          "amount": 1
        },
        "parameters": {
          "notes": "Adds 1 to this host's counter in the Data Store, creating it at 1 the first time. Returns { key, value } with the new total."
        }
      },
      "type": "basic"
    }
  ],
  "edges": [
    {
      "id": "e-nav-host",
      "type": "flowEdge",
      "source": "trigger-nav",
      "target": "extract-host"
    },
    {
      "id": "e-host-inc",
      "type": "flowEdge",
      "source": "extract-host",
      "target": "increment-host"
    }
  ]
}