Gassian
Installation
npm install gassian
import GAS from 'gassian'
const GAS = require('gassian')
Usage
Initialize GAS
const gas = new GAS({
product: 'bitbucket',
subproduct: 'addon-template',
domain: 'prod.atlassian.com'
})
GAS constructor parameters
Parameter | Required | Default | Type | Description |
---|
apiUrl | yes | | string | Removed from the library by security reason. You can take URL from GAS documentation (Atlassian internal only). Don't forget to add version to URL |
product | yes | | string | Product name (for add-ons main product name can be passed, e.g. jira or bitbucket) |
subproduct | no | | string | Add-on name like addon-template |
domain | yes | | string | Production domain. E.g. prod.atlassian.com |
version | no | | string | '1.2.3' |
prefix | no | false | boolean | It adds subproduct name to event name. E.g. addon-template.project-config.visited |
hash | no | true | boolean | UserId and cloudId are hashed by default. Set to false if you need actual user data. |
isServerOnProduction | yes (server only) | | boolean | We can detect actual URL in browser with window.location.href . But it's tricky on server-side. That's why we need it on server |
logging | no | false | boolean | Logs prepared to send event to console. Remove this parameter in production |
Send event/events
const event = {
cloudId: 'Instance id or URL',
user: 'User id or name',
name: 'visited',
page: 'project-config'
}
gas.send(event)
gas.send([event1, event2])
`project-config.visited`
`addon-template.project-config.visited`
Event payload
Parameter | Required | Default | Type | Description |
---|
name | yes | | string | Event dotseparated name. E.g. some-button.clicked |
page | no | | string | E.g. project-config which will included in event name as project-config.some-button.clicked |
user | yes | '-' | string or integer | Unique user id which will be hashed (for not exposing private data) |
cloudId | yes | | string or integer | Cloud id or cloud URL |
properties | no | | object | One level nested object. Only primitive (int, float, string, bool) values are allowed |
hash | no | | boolean or object | Enable or disabling hashing for one event. Also, it can accept object with cloudId or/and user with boolean to hash one of the values. |