Skip to content

Instantly share code, notes, and snippets.

@khamiltonuk
Last active October 23, 2018 11:35
Show Gist options
  • Select an option

  • Save khamiltonuk/ca19821015c7c0b6115bd1fdaf5c0852 to your computer and use it in GitHub Desktop.

Select an option

Save khamiltonuk/ca19821015c7c0b6115bd1fdaf5c0852 to your computer and use it in GitHub Desktop.
Track js

Trackjs

give applications at signavio reall time monitoring of veerthing that happens

Where is it

Track js is inserted as one of the first script tags at the buttom of our html page It uses a noncenonce just before our

<script nonce="" type="text/javascript">
    window._trackJs = {
        token: 'XXXXXXX', // unique token for our trackjs account
        version: 'v3.74.0', // Workflow version number
        application: 'prod' // posibilities include staging|dev|prod
        onError: function (payload, error) {
          // Payload can be manipulated to hide sensitive user information exposed in url
        }
    };
</script>

The above snipet comes form the backend and is located here src/main/webapp/WEB-INF/templates/pages/indexBody.peb

Testing

Trackjs is only configured to work in workflow production and staging. You can test from your local enviroment if you send messages to track js, you will need to change this file. src/main/java/com/effektif/controllers/model/SystemConfiguration.java Also you will need to configure the Content Security policy for the dev enviroment src/main/java/com/effektif/CSPBuilder.java

Further Reading

To learn more about Content security policy here is a video taken from JSConf Budapest 2017. Kacper Sokołowski: You use Content Security Policy, don't you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment