<commit_before>SDK for adding SWAYco surveys to your site
==========================================

## Quick start ##

- Register on [SWAYco](http://swayco.co) site
- Go to [account page](http://swayco.co/app)
- Press "Add an Website" button and fill the form
- Copy `distribution id` at top of the page and `application id` of just added website
- Add scripts to your page:

```
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="//cdn.swayco.co/public/js/jquery.sway.0.0.2.js"></script>
```

- Init SDK:

```
var swayIcon = new SwayIcon({
    distribution_id: 'distribution_id',
    application_type: 'web',
    application_id: 'application_id',
    onSuccess: function(surveyFrom) {
      // developer or researcher
      console.log('survey from', surveyFrom);
      
      // hide icon and survey:
      swayIcon.hideIcon();
    }
});
```

- Check user compatibility and load survey if we have surveys for current user:

```
swayIcon.checkUserCompatibility({}, function(resp) {
  // resp can be one of: yes, no, may_be
  console.log(resp);
  if(resp == 'yes' || resp == 'may_be') {
    // load survey
    swayIcon.loadSurvey({}, function() {
      console.log('survey loaded (loadSurvey callback)');
      
      // show Sway icon
      swayIcon.showIcon({});
    });
  }
});
```


## API ##

### Constructor ###<commit_msg>fix - add requirements and syntax highlighting to readme file<commit_after>SDK for adding SWAYco surveys to your site
==========================================

## Requirements ##
- jQuery >= 1.8

## Quick start ##

- Register on [SWAYco](http://swayco.co) site
- Go to [account page](http://swayco.co/app)
- Press "Add an Website" button and fill the form
- Copy `distribution id` at top of the page and `application id` of just added website
- Add scripts to your page:

```html
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="//cdn.swayco.co/public/js/jquery.sway.0.0.2.js"></script>
```

- Init SDK:

```js
var swayIcon = new SwayIcon({
    distribution_id: 'distribution_id',
    application_type: 'web',
    application_id: 'application_id',
    onSuccess: function(surveyFrom) {
      // developer or researcher
      console.log('survey from', surveyFrom);
      
      // hide icon and survey:
      swayIcon.hideIcon();
    }
});
```

- Check user compatibility and load survey if we have surveys for current user:

```js
swayIcon.checkUserCompatibility({}, function(resp) {
  // resp can be one of: yes, no, may_be
  console.log(resp);
  if(resp == 'yes' || resp == 'may_be') {
    // load survey
    swayIcon.loadSurvey({}, function() {
      console.log('survey loaded (loadSurvey callback)');
      
      // show Sway icon
      swayIcon.showIcon({});
    });
  }
});
```


## API ##

### Constructor ###
{'fraction_non_alphanumeric': 0.180858310626703, 'fraction_numerical': 0.004768392370572207, 'mean_word_length': 3.4032983508245875, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6550194', 'n_tokens_mistral': 954, 'n_tokens_neox': 924, 'n_words': 254}