Builder
Embed the builder
Put our card builder on your own website, with the templates on your account. Paste one line of HTML. Your visitors design their card and order it on Snapshot.
Three ways to embed the card builder
There are three kinds. All three come from the same one line you paste into your page:
- A button. One “Make your card” button. It opens our card builder in a new tab, with one of your templates already chosen.
- A frame. Your templates, shown inside your page. A visitor picks one, and the builder opens in a new tab with it chosen.
- A design frame, paid at your checkout. The shopper designs the card inside your page. You take the payment in your own checkout. Your server then orders the design through the partner API. It has its own guide: Embed: design here, pay at your checkout.
With the button and the frame, the visitor designs the card and pays on Snapshot, in that new tab. Here is why. A browser keeps a page inside a frame separate from the same site opened on its own. So a card that a signed-out visitor started in the frame could not follow them to the tab where they sign in and pay. Designing in the tab keeps every card they make.
The design frame keeps nothing in the browser. The card is drawn and saved on our servers, so the shopper does not need to sign in.
Before you start
- A publishable key. An owner or a manager makes one on the Developers page of the partner portal. The key names the website addresses (origins) the embed will run on. See API keys.
- Templates on your account. The portal’s Templates page lists them and says which ones the embed offers (Templates for your account).
The portal’s Embed page writes the line to paste for you:
- Choose the publishable key.
- For the button and the frame, paste the whole key. The portal shows a key only once, so paste the copy you kept. The key stays in that page and is not sent anywhere.
- Choose a template and the kind. For the button, the page shows a preview of how it will look.
- For the design frame, choose your page’s origin instead of pasting the key. The page also writes the request your server sends to start a session.
The button
<script src="https://www.makesnapshots.com/embed.js" data-key="sn_live_pk_…" data-template="<template id>" async></script>The button appears where the line is. It is a link, so keyboards and screen readers treat it as one. It also tells screen readers that it opens a new tab. It is drawn in its own shadow root, so your page’s styles do not change it.
| Attribute | What it is |
|---|---|
data-key | Your publishable key. Required. |
data-template | The id of one of your templates that the embed offers. Required for the button. The Embed page fills it in. |
data-mode | Leave it out, or button, for the button; frame for the frame; design for the design frame, which takes data-session instead of a key (how). |
data-height | For the frame: its height in pixels, from 360 to 1200. Without it, 640. |
data-white-label | For the frame and the design frame: true leaves out the “Cards by Snapshot” link under the frame. |
For a single-page app, the same script also adds window.SnapshotEmbed.mount(element, options). Pass the element (or a CSS selector) and the same values as options: key, template, mode, session, height and whiteLabel. It returns an object with a destroy() method that removes the embed.
The frame
<script src="https://www.makesnapshots.com/embed.js" data-key="sn_live_pk_…" data-mode="frame" async></script>The frame lists the templates your account offers in the embed (at most 24). Each one has its picture and a “Design this card” button that opens the builder in a new tab. Add data-template to show just one template. The frame fills the full width of the place you put it.
Under the frame, the line adds a “Cards by Snapshot” link to our site. The link sits outside the frame, and you may remove it.
The frame runs no script and carries no advertising or analytics tag. It asks search engines not to index it.
The origin rule
The embed works only on the origins your publishable key names. They must match exactly: the scheme, the host, and the port if there is one, like https://shop.example.com. A test key may also name http://localhost:3000, so you can build on your own computer.
- The button checks the key with our server from your page’s own origin. Our server answers only the key’s origins.
- The frame tells the browser that only the key’s origins may show it. On any other site, the browser shows nothing.
- Some keys draw nothing at all: a key that is not valid, a revoked key, a secret key, or a key used on another origin. The script then writes one warning in the browser’s console, saying why when it can.
- A secret key in a web page is refused before anything else.
- When you revoke a key on the Developers page, its embed stops on the next page view.
- If your page sends a Content-Security-Policy, allow it to load scripts from and connect to
https://www.makesnapshots.com. For the frame, also allow frames from it.
Which templates the embed offers
Every template on your account, except the ones below. The Templates page gives the reason for each one the embed leaves out:
- It is a limited slab drop, sold only as a Slab from the builder.
- The template is not in the card builder right now.
- The template is in a series the builder does not show to signed-out visitors.
- It is made with AI, and a visitor needs an account for that. The embed offers templates anyone can finish.
- The template has no design to build on.
What a frame protects, and what it cannot
| Stays on our servers | Reaches the browser |
|---|---|
| Print-resolution files, plates and finish data | The builder’s JavaScript, in the new tab on our site, as for every visitor |
| Template design layers at full size | Template pictures at preview size |
| The AI pipeline, its prompts and keys | The preview of the card being made, in the visitor’s own tab |
| Pricing rules, and the order and billing logic | Your page’s own script gets nothing from the embed but the button or the frame |
- You never host or receive our code. You paste one line.
- Code that runs in a browser can be read. That is already true of our site, so the embed exposes nothing new. The frame itself runs no code, and the builder is the same one as on our site.
- A publishable key is public by design. Anyone can read it in your page and copy it. On another site it does nothing. Opening the frame’s address directly shows only the names and pictures of the templates your embed offers.
- The button and the frame offer only templates the builder shows to everyone, so there is no private design to hide.
- The design frame may offer a template made just for your account. It draws the card on our servers, so only a watermarked preview reaches the browser.
Visits from your embed
The builder address carries utm_source=partner-embed, utm_medium=embed, and your account’s id as utm_campaign. Our site records these on a visitor’s first visit, so sign-ups that come from your embed are credited to your account.
Input and photo handling
- Shoppers upload their own photo inside the builder or the design frame. That way the shopper gives the upload and confirms the rights to the photo.
- To fill in a player’s details from your own database or checkout, use the design frame. Your server can send those details when it starts each session.