Embedded Analytics Sandbox
The inputs required to use this sandbox are generated from creating a new embed link on a Holistics dashboard.
Here are some steps to get you started:
Step 1: Prepare your dashboard in Holistics, and include a dropdown filter with your customer IDs as the key.
Step 2: Generate your embedded link, which will give you your embed code and secret key. Test the customer IDs.
Step 3: Select your preferred programming language, and place your embedded iframe inside your application.
# You need to install 3rd party for Json Web Token in Ruby # Run 'gem install jwt' (Or add gem 'jwt' to your GemFile) # E.g: your customer ID is 1 and you want to expire the token after 1 hour customer_id = {{ customerIdForm }} secret_key = "{{ secretKeyForm }}" expired_time = Time.now.to_i + 24 * 60 # e.g: expired_time = 1498795702 payload = {customer_id: customer_id, exp: expired_time} token = JWT.encode(payload, secret_key, 'HS256')
import time import jwt # pip install PyJWT # e.g your Customer_Filter's value is 2, and the token will be expired after 1 hour. customer_id = {{ customerIdForm }} secret_key = "{{ secretKeyForm }}" expired_time = int(time.time()) + 24 * 60 payload = { 'customer_id': customer_id, 'exp': expired_time } # the 3rd parameter of jwt.generate_jwt is the time to expire the token. token = jwt.encode(payload, secret_key, 'HS256') # expires in 27/10/2018 token = token.decode('utf-8') # This is to remove b-prefix of byte literals
// npm install jsonwebtoken
var jwt = require('jsonwebtoken'); var customer_id = {{ customerIdForm }}; var secret_key = "{{ secretKeyForm }}" var expired_time = Math.floor(Date.now() / 1000) + (60 * 60); ; token = jwt.sign({ exp: expired_time, customer_id: customer_id }, secret_key);
# We need to install 3rd party library for JWT. # Please refer to this link for installation: https://github.com/jwtk/jjwt; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.impl.crypto.MacProvider; int customer_id = {{ customerIdForm }}; String secret_key = "{{ secretKeyForm }}"; String token = Jwts.builder().setExpiration(new Date(1300819380)) .claim("customer_id", customer_id) .signWith(SignatureAlgorithm.HS256, secret_key.getBytes("UTF-8")).compact();
# We need a 3rd party for JWT # Please refer to this link for the installation of Json Web Token: # https://github.com/garyf/json_web_token_ex import JsonWebToken customer_id = CUSTOMER_ID secret_key = "YOUR SECRET KEY" expired_time = DateTime.to_unix(DateTime.utc_now) + 24 * 60 payload = %{customer_id: customer_id, exp: expired_time} token = JsonWebToken.sign(payload, %{key: secret_key})