From f15f3899b1ef9275e0a31a5b819768b040e2e339 Mon Sep 17 00:00:00 2001 From: Philipp Meisen Date: Wed, 12 Apr 2017 15:35:02 -0700 Subject: [PATCH] final snippets --- .../snippets/language-login-activity.md | 2 - .../snippets/language-pagevisit-activity.md | 1 - .../snippets/language-purchase-activity.md | 6 --- .../language-request-temporal-data.md | 48 ++++++++++--------- .../snippets/language-resolve-ip-address.md | 4 +- .../snippets/language-reverse-geocoding.md | 4 +- 6 files changed, 30 insertions(+), 35 deletions(-) diff --git a/documentation/snippets/language-login-activity.md b/documentation/snippets/language-login-activity.md index 9e705f2..66de7e5 100644 --- a/documentation/snippets/language-login-activity.md +++ b/documentation/snippets/language-login-activity.md @@ -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'); ``` \ No newline at end of file diff --git a/documentation/snippets/language-pagevisit-activity.md b/documentation/snippets/language-pagevisit-activity.md index 19c2850..c52ca32 100644 --- a/documentation/snippets/language-pagevisit-activity.md +++ b/documentation/snippets/language-pagevisit-activity.md @@ -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'); ``` \ No newline at end of file diff --git a/documentation/snippets/language-purchase-activity.md b/documentation/snippets/language-purchase-activity.md index a733106..cb067c7 100644 --- a/documentation/snippets/language-purchase-activity.md +++ b/documentation/snippets/language-purchase-activity.md @@ -1,13 +1,7 @@ -
-

The JavaScript library offers several overloaded version -of the temporalData method.

-
- > ```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' ], diff --git a/documentation/snippets/language-request-temporal-data.md b/documentation/snippets/language-request-temporal-data.md index 6e80fa5..78b171e 100644 --- a/documentation/snippets/language-request-temporal-data.md +++ b/documentation/snippets/language-request-temporal-data.md @@ -1,35 +1,39 @@ -
-

The JavaScript library offers several overloaded version +

+

The Node.js library offers several overloaded versions of the temporalData method.

-
-

Callback only

-

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.

-
- > -```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); }); ``` -
-

Providing a User Instance

-

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 -further use cases to see other examples.

-
- > -```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); +}); +``` \ No newline at end of file diff --git a/documentation/snippets/language-resolve-ip-address.md b/documentation/snippets/language-resolve-ip-address.md index be7b4ab..b42eb46 100644 --- a/documentation/snippets/language-resolve-ip-address.md +++ b/documentation/snippets/language-resolve-ip-address.md @@ -1,4 +1,4 @@ -
+

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 @@ -7,7 +7,7 @@ used framework) available to determine your client's ip, for example, see

> -```javascript--browser +```javascript--node breinify.temporalData('72.229.28.185', function(data) { console.log(data); }); diff --git a/documentation/snippets/language-reverse-geocoding.md b/documentation/snippets/language-reverse-geocoding.md index 6b0bcd6..d26d4cb 100644 --- a/documentation/snippets/language-reverse-geocoding.md +++ b/documentation/snippets/language-reverse-geocoding.md @@ -4,7 +4,7 @@ and use the resolved information.

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

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