contexture · live
visit· session views· total views· time on site· avg views/visit· days since last·
sample

behavioral profile

visitor type
·
first page of session
·
avg time on site
·
engagement
·

query yourself · CX.io()

CX.io(
//==> run a query to see your own context

the library

Contexture, the instrument.

A 6 KB, zero-dependency, source-available client-side library. One normalized surface to collect signals, calculate context, and syndicate it to the tools you already own.

6 KB

Gzipped, loads first. Runs on every page without slowing it.

0

Dependencies, ever. No framework, no build step, no runtime to install.

1st-party

Anonymous, consent-gated. Storage you and the visitor own.

source-available

PolyForm Noncommercial for personal use. Free to read; licensed to deploy commercially.

install the library

One line, first in your tag manager

You self-host the single file and load it as the first on-page snippet. It is stable by design: frozen, dependency-free, and it will never push a breaking change to a client site.

<!-- first tag in the container, before everything else -->
<script src="/assets/Contexture.js"></script>
i · collect

Read context with io()

Out of the box, Contexture assembles nine data groups into one query surface. Call io() for the full context, io(dataGroup) for one group, or io(dataType, dataName) for one item.

Contexture.io()                              //==> { metaData, cookieData, ... }
CX.io("behavior", "totalPageViews")         //==> "10"
CX.io("param", "utm_campaign")            //==> "spring_launch"
CX.io("behavior")                              //==> { visit, sessionPageViews, ... }  // CX and CXTR are aliases
ii · calculate

Hook the calc lifecycle

Custom calculations are global hooks, not library methods. Define them once; Contexture runs them during the calc lifecycle. Record engagements with track() using the documented object form.

// record an engagement (goal, product view, step)
CX.track({ event: "click", action: "goal", data: { id: "newsletter" } });

// custom calculation hooks (runs during calc lifecycle)
window.CXcalculate = function () { /* after each page calc */ };
window.CXsessionCalc = function () { /* once per session */ };
window.CXpageCalc = function () { /* once per pageview */ };

source: appendix a and the debugger's window.documentation. Advanced calculation patterns (affinity, scoring, cart) are documented in the book and install per engagement.

iii · syndicate

Push context with window.CXExport

Syndication is a global hook, not a method. Define window.CXExport and the library runs it automatically after every calculation (or fire manually with CX.export()).

// runs automatically after every calculation; also fire manually with CX.export()
window.CXExport = function () {
  var url = 'https://data.mysite.io/log?' + CX.io('behavioral', 'params');
  CX.send(url);  // gate on consent; keep PII out of the URL
};
the augmentation play

You already bought the testing tool. This makes it do things it couldn't.

The page-parameters seam, defined before at.js loads. Feed first-party affinities and scores into audiences Target could never compute on anonymous traffic.

// define before at.js loads (Ch 10)
window.targetPageParamsAll = function () {
  return {
    "user.visitorType":    CX.io("visitorType"),
    "user.visitCount":     CX.io("visit"),
    "audience.highIntent": CX.io("audience.highIntent")
  };
};

source: ebook part iii, chapters 10 to 13.

The privacy model

Anonymous by default. An anonymous first-party UUID, behavioral attributes only, no PII, no third-party sharing. Storage and any beacon wait for consent, exactly as the book's privacy chapter prescribes. The ticker at the top of this page is that pattern, live.

Next steps

Read the full getting-started and API reference in the docs, or open the Toolkit to debug the calculation layer in isolation before you syndicate.

The library is free to read. Licensed to deploy.

PolyForm Noncommercial covers personal and noncommercial use. Commercial deployment requires a license. Read everything freely; license the library to deploy it commercially.