Skip to content

Commit 9bd6644

Browse files
committed
fixed snippets and documentation
1 parent e947697 commit 9bd6644

File tree

5 files changed

+45
-15
lines changed

5 files changed

+45
-15
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ First of all, you need a valid API-key, which you can get for free at [https://w
1111

1212
**772A-47D7-93A3-4EA9-9D73-85B9-479B-16C6**
1313

14-
There are currently two different end-points available through the API. The first one is used to send data - so called activities - to the engine, whereas the second one is used to retrieve data from it (lookup).
14+
There are currently three different end-points available through the API. The first one is used to send data - so called activities - to the engine, whereas the second is used to retrieve temporal data from the engine for a visitor (e.g., the current city, weather, or the current timezone, or the current holidays), and the last one is used to look up detailed information about your visitor (e.g., first name).
1515

1616
The following code-snippet shows how easy it is to utilize the different end-points:
1717

1818
```html
1919

2020
<!-- load the library -->
21-
<script src="https://cdn.jsdelivr.net/breinify-api/1.0.6/breinify-api.min.js"></script>
21+
<script src="https://cdn.jsdelivr.net/breinify-api/1.0.7/breinify-api.min.js"></script>
2222
<script>
2323
/*
2424
* Configure the library (see 'further links' for a full list)
@@ -35,6 +35,19 @@ The following code-snippet shows how easy it is to utilize the different end-poi
3535
'email': Breinify.text('input[name="name"]')
3636
}, 'login');
3737
}
38+
39+
/*
40+
* If you want your visitor to see the current weather
41+
* (holidays, location), or if you'd like to know it
42+
* (for analytical purposes or just to personalize the
43+
* store).
44+
*/
45+
Breinify.temporalData(function(data) {
46+
if (typeof data.weather !== 'undefined') {
47+
window.alert('The temperature is currently ' + data.weather.temperature);
48+
}
49+
});
50+
3851
/*
3952
* You may want to greet your visitor appropriately, so let's
4053
* look-up the first name. For a full list of dimensions have
@@ -60,4 +73,5 @@ To understand all the capabilities of Breinify's DigitalDNA API, you should have
6073
* the [API library documentation](documentation/api.md),
6174
* an [example using Google Tag Manager](documentation/example-google-tag-manager.md),
6275
* a [more comprehensive example](documentation/example-comprehensive.md), or
76+
* the [full API documentation](https://www.breinify.com/documentation/index.html)
6377
* [Breinify's Website](https://www.breinify.com).

documentation/snippets/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
>
22
```javascript
33
<!-- load the library -->
4-
<script src="https://cdn.jsdelivr.net/breinify-api/1.0.6/breinify-api.min.js"></script>
4+
<script src="https://cdn.jsdelivr.net/breinify-api/1.0.7/breinify-api.min.js"></script>
55
```
66

77
>

documentation/snippets/temporal.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
> ```javascript
22
> var withSecret = false;
33
>
4-
> // Example with just IP address set
5-
> var response = Breinify.temporalData({
6-
> 'ipAddress': '74.115.209.58'
7-
> }, withSecret);
4+
> // Example to retrieve temporal information through available information
5+
> Breinify.temporalData(function(data) {
6+
> window.alert(JSON.stringify(data, null, 2));
7+
> });
88
> ```
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
> ```javascript
22
> var withSecret = false;
3-
>
4-
> // Example with full user data
5-
> var response = Breinify.temporalData({
6-
> 'ipAddress': '74.115.209.58',
7-
> 'localDateTime': 'Wed Oct 26 2016 13:02:06 GMT-0700 (EDT)',
8-
> 'timezone': 'America/New_York'
9-
> }, withSecret);
3+
>
4+
> // Example to retrieve temporal information through additional information
5+
> Breinify.temporalData({ 'email':'example@breinify.com' }, function(data) {
6+
> window.alert(JSON.stringify(data, null, 2));
7+
> });
108
> ```

documentation/step-by-step.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ bower install https://github.com/breinify/brein-api-library-javascript-browser/t
2929
```
3030

3131
##### Using *npm* to download the library
32-
Please pick 1 of the following:
32+
Please pick one of the following:
3333
```bash
3434
npm install breinify/brein-api-library-javascript-browser
3535
npm install github:breinify/brein-api-library-javascript-browser
3636
npm install https://github.com/breinify/brein-api-library-javascript-browser/tarball/master
3737
```
3838

39+
**Note**: We provide a specific library to be used with node, see [here](https://www.npmjs.com/package/breinify-node).
40+
3941
##### Download the library directly from GitHub
4042

4143
or just download the version from [GitHub](https://raw.githubusercontent.com/Breinify/brein-api-library-javascript-browser/master/dist/breinify-api.min.js) directly.
@@ -102,6 +104,22 @@ A full list of the available utility functions (*Breinify.UTL*) and there purpos
102104

103105
##### Placing look-up triggers
104106

107+
Temporal data can be used to personalize your content, e.g., to change the appearance of the site regarding holidays (even local holidays), weather, part of time (e.g., afternoon, evening), or events.
108+
109+
```html
110+
<script>
111+
Breinify.UTL.events.pageloaded(function () {
112+
Breinify.temporalData(function (data) {
113+
if (!Breinify.UTL.isEmpty(data)) {
114+
window.alert('It is currently ' + data.weather.temperature);
115+
}
116+
});
117+
}
118+
</script>
119+
```
120+
121+
##### Placing look-up triggers
122+
105123
Look-ups are used, e.g., to change the appearance of the site, increase the quality of service by enhancing recommendations or pre-filtering search results. In the following simple example, the site's message is adapted when the page is loaded.
106124
107125
```html

0 commit comments

Comments
 (0)