Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeisen committed Apr 12, 2017
1 parent fdcb134 commit 453c9b6
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 67 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The example shows, how to send a login activity, reading the data from an reques

```javascript
// the req object may be passed, e.g., using express:
// app.post('/login', function(req, res)
// app.post('/login', function(req, res) { ... });

var user = {
'sessionId': req.sessionID,
Expand All @@ -77,7 +77,7 @@ It is also possible to send additional information with an activity, e.g., which

```javascript
// the req object may be passed, e.g., using express:
// app.post('/addItem', function(req, res)
// app.post('/login', function(req, res) { ... });

var user = {
'sessionId': req.sessionID
Expand Down
10 changes: 7 additions & 3 deletions documentation/snippets/language-config.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<blockquote class="lang-specific javascript--node">
<p>It is recommended to use the Node.js library with a signature (i.e.,
the <code class="prettyprint">Verification Signature</code> in the UI should be enabled and the secret is needed).
the <code class="prettyprint">Verification Signature</code> in the UI
should be enabled and the secret is needed).</p>
<p>Whenever a <code class="prettyprint">Breinify</code> instance is created,
the configuration has to be specified.</p>
</blockquote>

>
```javascript--browser
Breinify.setConfig({
```javascript--node
var Breinify = require('breinify-node');
var breinify = new Breinify({
'apiKey': '938D-3120-64DD-413F-BB55-6573-90CE-473A',
'secret': 'utakxp7sm6weo5gvk7cytw=='
});
Expand Down
13 changes: 7 additions & 6 deletions documentation/snippets/language-example.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<blockquote class="lang-specific javascript--browser">
<p>You selected the documentation for the JavaScript language utilizing the JavaScript Browser library.
The library is deployed under the MIT License and is available as <a href="https://github.com/Breinify/brein-api-library-javascript-browser">open-source project</a>
<blockquote class="lang-specific javascript--node">
<p>You selected the documentation for Node.js library.
The library is deployed under the MIT License and is
available as <a href="https://github.com/Breinify/brein-api-library-node">open-source project</a>
on GitHub.</p>
</blockquote>

>
```javascript--browser
```javascript--node
/*
* I'm an example snippet of the JavaScript library. The following
* I'm an example snippet of the Node.js library. The following
* documentation should help you to get started with the library.
* Even more examples and documentation can be found at:
*
* https://github.com/Breinify/brein-api-library-javascript-browser
* https://github.com/Breinify/brein-api-library-node
*/
```
51 changes: 4 additions & 47 deletions documentation/snippets/language-integrate.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,9 @@
<blockquote class="lang-specific javascript--browser">
<p>There are multiple ways on how to integrate the library within your project.
The library is available on bower, jsdelivr (CDN), npm, or as download from GitHub.</p>
</blockquote>

<blockquote class="lang-specific javascript--browser">
<h3>Using Bower</h3>
<p>The library can be installed via bower, further information about bower can be found
<a href="https://bower.io" target="_blank">here</a>.</p>
</blockquote>

>
```javascript--browser
bower install breinify-api --save
```

<blockquote class="lang-specific javascript--browser">
<h3>jsdelivr (CDN)</h3>
<p>The library can be loaded directly within the html code from .
<a href="https://www.jsdelivr.com/" target="_blank">jsdelivr</a>. Please replace
the {version} placeholder with the version you would like to use.
To see a list of all available version have a look
<a href="https://www.jsdelivr.com/projects/breinify-api" target="_blank">here</a></p>
</blockquote>

>
```javascript--browser
<script type="text/javascript" src="https://cdn.jsdelivr.net/breinify-api/{version}/breinify-api.min.js"></script>
```

<blockquote class="lang-specific javascript--browser">
<p>To use the most current SNAPSHOT version, you can also use the following URL.
This URL should only be used for developing purposes (see also <a href="https://rawgit.com/" target="_blank">rawgit.com</a>).</p>
</blockquote>

>
```javascript--browser
<script type="text/javascript" src="https://rawgit.com/Breinify/brein-api-library-javascript-browser/master/dist/breinify-api.min.js"></script>
```

<blockquote class="lang-specific javascript--browser">
<h3>Using npm</h3>
<p>The library can be installed via npm, further information about npm can be found
<a href="https://www.npmjs.com/" target="_blank">here</a>. It should be mentioned that it is
<b>not recommended</b> to use this library with Node.js, instead use the
<a href="https://github.com/Breinify/brein-api-library-node" target="_blank">Node.js Library</a></p>
<blockquote class="lang-specific javascript--node">
<p>The library is distributed through Node.js package manager
(<a href="https://www.npmjs.com/package/breinify-node">npm</a>).</p>
</blockquote>

>
```javascript--browser
npm install breinify-api --save
npm install breinify-node --save
```
14 changes: 10 additions & 4 deletions documentation/snippets/language-login-activity.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
>
```javascript--browser
var sId = Breinify.UTL.cookie.get('JSESSIONID');
var email = '[email protected]'; // typically read from an input field
Breinify.activity({ 'sessionId': sId, 'email': email }, 'login');
```javascript--node
// the req object may be passed, e.g., using express:
// app.post('/login', function(req, res) { ... });
var user = {
'sessionId': req.sessionID,
'email': req.body.email
};
breinify.activity(user, 'login');
```
8 changes: 5 additions & 3 deletions documentation/snippets/language-pagevisit-activity.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
>
```javascript--browser
var sId = Breinify.UTL.cookie.get('JSESSIONID');
Breinify.activity({ 'sessionId': sId }, 'pageVisit');
```javascript--node
// the req object may be passed, e.g., using express:
// app.post('/login', function(req, res) { ... });
breinify.activity({ 'sessionId': req.sessionID }, 'pageVisit');
```
7 changes: 5 additions & 2 deletions documentation/snippets/language-purchase-activity.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ of the <code class="prettyprint">temporalData</code> method.</p>
</blockquote>

>
```javascript--browser
```javascript--node
// the req object may be passed, e.g., using express:
// app.post('/login', function(req, res) { ... });
var sId = Breinify.UTL.cookie.get('JSESSIONID');
var tags = {
'productIds': [ '125689', '982361', '157029' ],
'productPrices': [ 134.23, 15.13, 12.99 ]
};
Breinify.activity({ 'sessionId': sId }, 'checkOut', tags);
Breinify.activity({ 'sessionId': req.sessionID }, 'checkOut', tags);
```

0 comments on commit 453c9b6

Please sign in to comment.