Skip to content

Commit

Permalink
final snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeisen committed Apr 12, 2017
1 parent a150d63 commit f15f389
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 35 deletions.
2 changes: 0 additions & 2 deletions documentation/snippets/language-login-activity.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
```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');
```
1 change: 0 additions & 1 deletion documentation/snippets/language-pagevisit-activity.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
```javascript--node
// the req object may be passed, e.g., using express:
// app.post('/login', function(req, res) { ... });
breinify.activity({ 'sessionId': req.sessionID }, 'pageVisit');
```
6 changes: 0 additions & 6 deletions documentation/snippets/language-purchase-activity.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<blockquote class="lang-specific javascript--browser">
<p>The JavaScript library offers several overloaded version
of the <code class="prettyprint">temporalData</code> method.</p>
</blockquote>

>
```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' ],
Expand Down
48 changes: 26 additions & 22 deletions documentation/snippets/language-request-temporal-data.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
<blockquote class="lang-specific javascript--browser">
<p>The JavaScript library offers several overloaded version
<blockquote class="lang-specific javascript--node">
<p>The Node.js library offers several overloaded versions
of the <code class="prettyprint">temporalData</code> method.</p>
</blockquote>

<blockquote class="lang-specific javascript--browser">
<h3>Callback only</h3>
<p>If a single callback is provided, the library retrieves other available information
from the client automatically, e.g., the user-agent, the location (if and only if shared), or
the ipAddress.</p>
</blockquote>

>
```javascript--browser
Breinify.temporalData(function(data) {
```javascript--node
var latitude = 37.7749;
var longitude = -122.4194;
Breinify.temporalData(latitude, longitude, function(data) {
console.log(data);
});
```

<blockquote class="lang-specific javascript--browser">
<h3>Providing a User Instance</h3>
<p>Another possibility is to provide a user object manually. This is typically done, if
some specific temporal data should be resolved, e.g., a location based on a free text,
a pair of coordinates (latitude/longitude), or a specific ip-address. Have a look at the
<a href="#example-use-cases">further use cases</a> to see other examples.</p>
</blockquote>

>
```javascript--browser
var q = { additional: { ipAddress: '72.229.28.185' }};
Breinify.temporalData(q, function(data) {
```javascript--node
var ipAddress = '72.229.28.185';
Breinify.temporalData(ipAddress, function(data) {
console.log(data);
});
```

>
```javascript--node
// you can also pass in a more complex location object
var loc1 = {
'text': 'San Diego'
};
Breinify.temporalData({ 'location': loc1 }, function(data) {
console.log(data);
});
var loc2 = {
'latitude': 37.7749,
'longitude': -122.4194
};
Breinify.temporalData({ 'location': loc2 }, function(data) {
console.log(data);
});
```
4 changes: 2 additions & 2 deletions documentation/snippets/language-resolve-ip-address.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<blockquote class="lang-specific javascript--browser">
<blockquote class="lang-specific javascript--node">
<p>In general, the ip-address can be simply passed as first parameter. If you
would like to know more about your requesting client, you can also just pass in
the requesting ip-address. There are several different ways (also depending on the
Expand All @@ -7,7 +7,7 @@ used framework) available to determine your client's ip, for example, see
</blockquote>

>
```javascript--browser
```javascript--node
breinify.temporalData('72.229.28.185', function(data) {
console.log(data);
});
Expand Down
4 changes: 2 additions & 2 deletions documentation/snippets/language-reverse-geocoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ and use the resolved information.</p>
</blockquote>

>
```javascript--browser
```javascript--node
Breinify.temporalData(37.7609295, -122.4194155, function(data) {
console.log(data);
});
Expand All @@ -17,7 +17,7 @@ a location must be specified, together with the shapes to return.</p>
</blockquote>

>
```javascript--browser
```javascript--node
var loc = {
latitude: 40.7608,
longitude: -111.8910,
Expand Down

0 comments on commit f15f389

Please sign in to comment.