Skip to main content

Browser SDK

Browser SDK is a small script, window.sdk, that runs in the visitor's browser on PWA pages, on your prelandings and on your landings. Through it the page offers to install the app, subscribes the visitor to push, and sends events to Qubix analytics.

It is a separate thing from the Server SDK — the set of server-side commands (sql, fetch, state) that run in scripts, Britva auto-rules, and the landing page backend. The Server SDK runs on the Qubix server, while the Browser SDK runs right on the visitor's page. Two different tools: the Browser SDK is in the browser, the Server SDK is on the server.

What it can do​

  • Install the PWA — show the visitor the app install prompt and open an already installed app. See the Browser SDK reference.
  • Subscribe to push — request notification permission and create a subscription so the visitor can later receive push campaigns.
  • Events — report to analytics what happened on the page (a view, a push consent, an install), and send your own events.
  • Page tracking — count a visit from an ad and count the clicks and forms on the page. On a website uploaded to Qubix with Track events on, this happens by itself; on a website hosted elsewhere — by the code from its card, see Connecting a landing page hosted elsewhere; on any other page of your own — with a sdk.track() call. More — Your landing's statistics.
  • Traffic parameters — read the offer, the PWA, the visitor id, and the tracker tags that came with the click.

Where it is connected​

  • Automatically — on pages served by Qubix: the PWA store card, app pages, and a website uploaded to Landing pages with the Track events switch on (never on a Whitepage-type website). Nothing extra to do.
  • Manually — on your own site, or on an uploaded website where you turned Track events off. This lets you install and subscribe visitors right on your own page, without sending them to the store card. How to do it — see SDK on your prelanding. On the prelanding of a campaign with the Prelanding + PWA + offer target, the library is added by the same switch: if you turned it off, connect /sdk.js yourself, otherwise the button that leads to the store has nothing to call sdk.showStore() with.
note

App install and push work only over a secure connection (HTTPS) and on a domain that is set up in Qubix and active. More on this in the article about connecting on a prelanding.

What's next​