Skip to content
Official Djaty SDK for Javascript
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
test
web
.babelrc
.bowerrc
.editorconfig
.eslintrc
.gitattributes
.gitignore
README.md
bower.json
buildspec.yml
cSpell.json
gulpfile.js
package-lock.json
package.json
template.json
template.jst

README.md

Djaty Javascript SDK

Installation

Fetch djaty-javascript.js directly from Djaty CDN

<script type="text/javascript" src="https://cdn.djaty.com/js-sdk/djaty-javascript.js" djaty-api-key="YOUR_PROJECT_API_KEY_HERE"></script>

Install from NPM

$ npm install @djaty/djaty-javascript

<script type="text/javascript" src="/node_modules/@djaty/djaty-javascript/dist/djaty-javascript.js" djaty-api-key="YOUR_PROJECT_API_KEY_HERE"></script>

Usage

Quick Start

You can start using Djaty Javascript SDK with the default configuration by just passing the API key by djaty-api-key attribute. To set a custom configuration, just pass the config object to Djaty.init() method as the following example:

  <script type="text/javascript" src="https://cdn.djaty.com/js-sdk/djaty-javascript.js"></script>

  Djaty.init({
    apiKey: 'API_KEY',
    mode: 'full',
    user: {
      // It should be dynamic to get the current user ID for example from memory, cookies, localstorage, or anywhere else.
      userId: 1111,
    },
    tags: ['example_app'],
    stage: Djaty.constants.defaultStages.DEV,
    allowAutoSubmission: true,
    trackingOptions: {
      removeSecretData: false,
      cookies: true,
      localStorage: true,
      ajax: {
        headers: false,
        cookies: true,
        queryParams: true,
      },
      console: {
        excludedMethods : ['profile', 'info'],
        repetitionCount: true,
      },
      navigation: false,
      form: true,
    },
    release: '01.12.01',
    debug: true,
    onBeforeBugSubmission: (djatyBugReport, next) => {
      djatyBugReport.addCustomDataCb(() => 'test custom data');
      next(djatyBugReport);
    },
    ignoreTimelineItem: (item, utils) => {
      utils.console.log('For debugging purpose');
      return item.itemType === 'console' && item.consoleParams[0] === 'Debug';
    },
    ignoredErrors: ['localhost:9000/scripts/tracking/prodMain.js', 'TypeError: Cannot read property "value" of undefined', 'http://localhost:8089'],
  });

Development

Install dependencies

$ npm install

Serve

$ npm run serve

Build

$ npm run build

Run tests

$ npm run test

You can’t perform that action at this time.