Code snippets in Gtmhub
When building custom insights in Gtmhub, one will often use same or similar code frequently. That code may be the HTML used for the presentation, just as well as SQL or R for the algorithm.
Majority of insights in Gtmhub will be a simple number with a title.
This insight is displaying the number of open epics in JIRA. The HTML for this insight is simple, yet – not simple enough to write it every single time.
When insight has a complex presentation, such as a map of paying accounts, remembering how to write it is even more problematic.
The markup for this insight is quite verbose and complex. Writing this from the head is a pain.
Finally, many of the insights will have similar logic. At Gtmhub, we use a lot of insights that are based on the paying accounts (e.g. number of OKRs per paying account, number of users per paying account and so on). As this information is coming from Chargebee the logic to get paying accounts is always the same – but, we do need to join subscription and customers entities.
Introducing code snippets
To help our customers write new insights quicker and easier, we have introduced a new feature – code snippets. This feature allows you to save snippets you use often, right in Gtmhub.
The dialog for managing your code snippets can be opened from insight editor, by clicking on the My snippets button.
From the My snippets manager, you can create new snippets in HTML, SQL or R.
These snippets will then be saved, and you can copy them to clipboard every time you need them in the future.