'Embed code' for 'link shared' Notebooks

Hey,
I have some data analytics and viz for a client that I’d like to embed into one of our (html-based) presentations. However I can’t get the ‘embed code’ without publishing the full notebook, which is ofc not an option ^^’.

Thoughts?

Cheers,
JP

1 Like

There are two possibilities:

  1. You could just “share” the notebook rather than publish it. In this case, the notebook is still public but only to those who have the link.
  2. You can download the notebook and then embed from your local copy. This is a bit more work but generates code that runs completely independently of the observablehq.com.
  1. is exactly the issue, sharing doesn’t make the cells embeddable like publishing does.
  2. could work, but breaks automatic updating :confused:

If you enable link sharing, you can embed notebooks just as if you published it. E.g.,

https://api.observablehq.com/d/6d5a16cb40e00c2c.js?v=3

Which is the embedded version of

That is false; I do this frequently. Of course, the cell you want to export must still be named.

The more important issue with this is that you should only do it with data you kinda want to hide but for which security isn’t of paramount importance. If you really want to keep your data private, you should use the second technique and send the whole file to your client.

3 Likes

You can also use an API key to embed private notebooks, though note that you should be careful not to reveal your API key as anyone with the key can read your private notebooks.

4 Likes

Ah naming the cells did the trick, the published version had all the visualisations named, the linked one didn’t!

I wish the embed was greyed out with some explanation why it’s not embeddable right now ^^’

4 Likes

That is a pretty slick suggestion, I’d say! @mbostock

1 Like