To compose an embeddable URL, it requires being done on the server side for security. Below is a sample of Node Javascript on creating the data and signature for making an embeddable URL. Please reference our snippets repo for more examples: TractorScope Snippets Github Repo
const { createHmac } = require("crypto");
const key = 'Your TractorScope API Key';
// the dashboard you want to embed
const dashboard = 'dsh_01GRS8C4BVZ8X9N7E86Z82DQG9'
const expiresAtUtcUnix = moment().utc().add(10, "second").unix();
// compose the data object with filters and dashboard
const data = encodeURIComponent(
JSON.stringify({
dashboard,
filters: {
"Date Range": "last_month",
"Aggregation": "day",
"ClientId": "YourClientId",
// more filters here
},
expiresAtUtcUnix, // this is optional, makes the url expire, that way someone can't just get the iframe src and share it
})
);
// create the encrypted signature
const signature = createHmac("sha256", key).update(data).digest("hex");
// compose the embed url
const embedUrl = `https://app.tractorscope.com/embed/dashboard/${dashboard}?data=${data}&signature=${signature}`const { createHmac } = require("crypto");
const key = 'Your TractorScope API Key';
// the dashboard you want to embed
const dashboard = 'dsh_01GRS8C4BVZ8X9N7E86Z82DQG9'
const expiresAtUtcUnix = moment().utc().add(10, "second").unix();
// compose the data object with filters and dashboard
const data = encodeURIComponent(
JSON.stringify({
dashboard,
filters: {
"Date Range": "last_month",
"Aggregation": "day",
"ClientId": "YourClientId",
// more filters here
},
expiresAtUtcUnix, // this is optional, makes the url expire, that way someone can't just get the iframe src and share it
})
);
// create the encrypted signature
const signature = createHmac("sha256", key).update(data).digest("hex");
// compose the embed url
const embedUrl = `https://app.tractorscope.com/embed/dashboard/${dashboard}?data=${data}&signature=${signature}`