Embed link containing variables - is this possible?

Hi,

I’m new to metabase. The system is great for the intended use-cases, but I’m still in doubt if it fits one of my needs.

I need to 5000 groups of questions (not dashboards), each one with , lets say, 20 questions. For each group of question, there is only one parameter that changes. This is, all questions are the same, except for a

... WHERE city = {{city}}

In another system, I’ll create one page for each group of question, showing the tables and graphs among text an pictures.

I’ve already learned the possibilities to use variables and filter data. However, as far as I understood, it creates a dropdown at each question. However, what I need is the possibility to have an embed url like

mymetabase.org/?question=age_distribuition&city=rio-de-janeiro

so that I could automatically embed the right graph at the right page.

Is this use case fit to metabase? I would be glad to hear a “yes” answer, and some tips on how to do this.

best,
alan

Yes :slight_smile::

  1. As admin enable public sharing.

  2. For each of your 20’ish questions save them with a city parameter as you already described yourself. Share the question.

  3. Say your age_distribution question now ends up as public question number 5 and it has a city parameter you should be able to access it as e.g.:
    http://mymetabase.org/public/question/5?city=rio-de-janeiro

1 Like

Great, Jornh, thanks a lot!

Just for curiosity (it is really not a problem for me): instead of a nice number five, my public question has got a huge ID like http://localhost:3000/public/question/8575bd15-4baa-4d17-955e-4210da12d784.

Can I do something about it?

Glad I could help!

Must admit I didn’t try it out myself - guess the longer id’s are by design (there are both pros and cons to that I guess)

Hi,

I’m trying to do the same with the public share link for json:
https://metabase.xyz.com/public/question/10cbxyz.json?variable_name=123

It doesn’t work. Seems to work only for non-json links:
https://metabase.xyz.com/public/question/10cbxyz?variable_name=123

Am I doing something wrong?

I doubt that this would be considered ‘supported’, but you can change that long GUID to something smaller.
You need to share the dashboard as per normal first.
I’m using MySQL, but will be similar in others.
SELECT * FROM metabase.report_dashboard;
This gives you a list of all your dashboards. Find the ID of the dashboard you’ve just shared. It will have a column public_uuid that contains the long share GUID.
Assuming you’re dashboard has ID of 5 (from your question), use
UPDATE metabase.report_dashboard SET public_uuid='5' where id=5
Only downside is that the value shown in the dashboard’s share setting is now incorrect. You can use anything up to 36 characters long.
If you want to set all shared dashboards to have a share link that’s the same as their existing ID, use
UPDATE dalecaredashboard.report_dashboard set public_uuid=id where made_public_by_id=1

Just bear in mind that the reason for the long GUID is to prevent users just browsing through all the dashboards by ‘guessing’ the value of the share link.

hi i have the same problem of alantygel… but my db is MongoDB and i don’t know how set the variable for noSql.
The my idea is the same create 1 only question and controll the filter of this by url.
For example select only “Station”=“London”, and via url like: http://mymetabase.org/public/question/9?Station=London , see the date for london