Skip to main content

Seolyticize for Python

Every Seolyticize API tool (517 in 0.5.3) as a method, and on-site helpers for analytics, IndexNow and deploys. Standard library only, Python 3.9+.

pip install seolyticize

Quick start

from seolyticize import Seolyticize

client = Seolyticize()  # reads SEOLYTICIZE_API_KEY

# Onboard a site: one call returns everything to deploy.
manifest = client.onboard_site(domain="example.com", framework="html")
# …deploy manifest["files"] and the analytics snippet, then:
checklist = client.verify_site(client_id=manifest["clientId"])

# The weekly loop.
for item in client.get_next_steps(client_id=manifest["clientId"])["weekly"]:
    print(item["tool"], item["why"])

Paid research (any domain, the AI answer index, Maps, AI Mode beside rank) takes max_cost_micros. Quote the exact call first:

args = {"clientId": client_id, "target": "rival.com/blog/", "change": "new"}
quote = client.estimate_cost(tool="get_ranked_keywords", arguments=args)
ranked = client.get_ranked_keywords(
    client_id=client_id, target="rival.com/blog/", change="new",
    max_cost_micros=quote["estimatedMaxMicros"],
)

# Free reads over stored data:
pages = client.get_landing_pages(client_id=client_id, tracker_id=tracker_id)
grid = client.get_local_visibility(client_id=client_id, location_id=location_id, term="emergency plumber")
redirects = client.plan_redirect_map(client_id=client_id, old_crawl_id=old_crawl_id, format_="csv")

Arguments are keyword-only and snake_case (client_id, crawl_id); Python keywords get an underscore (from_). Tools newer than this package are reachable with client.call("tool_name", {"camelCase": "input"}). client.list_tools(group="onboarding") lists what your key may call, with schemas.

Errors

from seolyticize import RefusedError, RateLimitError

try:
    client.connect_search_console_service_account(client_id="client_…")
except RefusedError as error:
    print(error.code)        # "search_console_no_access" — branch on this
    print(error.next)        # what to do next
    print(error.request_id)  # quote it when asking for help

ValidationError (400), AuthenticationError (401), PermissionError (403), NotFoundError (404), RefusedError (422), RateLimitError (429), ServerError (5xx), NetworkError — all subclasses of SeolyticizeError. 429s are retried after Retry-After; server and network errors are retried only for read-only tools, since a write that failed may already have happened.

On your site

from seolyticize.site import analytics_tag, indexnow_key_response, notify_deploy, track_event

analytics_tag("SITE_KEY", exclude=["/account/*", "/verify"])  # the <script> for your <head>
body, headers = indexnow_key_response("KEY")                   # serve at /KEY.txt
notify_deploy("https://seolyticize.com/api/v1/hooks/deploy/dh_…")  # after each deploy
track_event("SITE_KEY", "https://example.com/pricing", name="Signup")  # server-side event

Server-side collection

Reports page views from the server — above all the AI assistants (ChatGPT-User, Claude-User, Perplexity-User) that read pages without running the browser tag. Needs the server key from issue_server_collect_key; keep it in the environment.

import os
from seolyticize.collect import ASGICollector, Collector, WSGICollector, django_middleware

collector = Collector("SITE_KEY", os.environ["SEOLYTICIZE_SERVER_KEY"],
                      exclude=["/admin/*", "/api/*"],
                      only="agents")  # with the browser tag installed too; "all" without it

app.wsgi_app = WSGICollector(app.wsgi_app, collector)      # Flask
app = ASGICollector(app, collector)                         # FastAPI / Starlette
SeolyticizeMiddleware = django_middleware(collector)        # Django: add to MIDDLEWARE

Only the path and utm_* parameters (change with allow_params), the referrer's origin, the visitor's address, user agent and country are sent; Seolyticize hashes the address and user agent under a daily salt and stores neither. Bots are dropped before anything is sent. Reports go out on a background thread and never raise.

To credit orders to the visit they came from, send a reference from the checkout — the tag's seolyticize('event', 'Checkout', {ref: cartId}), or collector.track(checkout_url, name="Checkout", props={"ref": cart_id}, user_agent=…, ip=…) with the visitor's own agent and address so it joins their visit — and put the same value in the order's metadata as seolyticize_ref (Stripe metadata, a Shopify cart attribute, Paddle custom_data).

A conversion that happens after the visit — a payment confirmed by webhook, a trial that converts next week — is credited to the visit by its token. Ask for it while the visitor is there and keep it on your server with the account (never in a cookie or the page); the token lasts 35 days:

visit = collector.track_for_visit(request.url, "Signup", user_agent=ua, ip=ip)  # returns the token
account.seolyticize_visit = visit
# ...days later, from the payment webhook:
collector.track_later(account.seolyticize_visit, "Top-up", props={"value": 25})

Docs: seolyticize.com/docs/python-sdk · Agent quick start: seolyticize.com/AGENTS.md

The tool methods are generated from the same registry that runs the API. License: MIT.

Metadata

Release files for seolyticize 0.5.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for seolyticize 0.5.13
File Size Uploaded Provenance Actions
seolyticize-0.5.13.tar.gz 172.6 kB Without provenance Details for seolyticize-0.5.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for seolyticize 0.5.13
File Interpreter ABI Platform Actions
seolyticize-0.5.13-py3-none-any.whl Python 3 none any Details for seolyticize-0.5.13-py3-none-any.whl

Total release size: 341.9 kB

Release files / seolyticize-0.5.13.tar.gz

Download URL seolyticize-0.5.13.tar.gz
Size 172.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c43f14821d1b2bbcb40a6fd8dc56795543b3ba471854cbeb0af4977478608d0c
BLAKE2b-256 checksum
How to use checksums
ea5ac00a7fb5c1d4e3fdd46b18466edbbaeab2671d3be9c1c3ebf10820f9a47a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / seolyticize-0.5.13-py3-none-any.whl

Download URL seolyticize-0.5.13-py3-none-any.whl
Size 169.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8139482ac926657353704a73c4722ac6d30622478565f180331960c4eeefea42
BLAKE2b-256 checksum
How to use checksums
217b0021faed211a18f0a17c7f0d591975de1499e37f04df1a2dd252cf05cfa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for seolyticize 0.5.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page