Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/features identify and trackactivity #1

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

spacewoox
Copy link
Contributor

  • initial documentation
  • eslint compliant
  • test ready with Jest

README.md Outdated
```

## identify(profile)
Then, you need to identify the user by providing a profile object with at least a **datasources** key.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The datasource is not mandatory. Furthermore, when you set up a datasource, you need to set the id AND the original_id.
You can read this part of the doc : http://doc.early-birds.fr/#identification-dun-utilisateur-nominatif

README.md Outdated
```js
const profile = {
datasources: [{
id: '[DATASOURCE_ID]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a datasource is set, it needs id and original_id

trackActivity(activity) {
return axios({
method: 'post',
url: `http://api.early-birds.fr/tracker/${this.trackerKey}/activity`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The URL "api.early-birds.fr" should be in a specific var, so it can be override with preprod-api or something like that if needed.
  2. API should be called through http if it's called by an http website, otherwise, it should be called through https.

identifyRequest(profile) {
return axios({
method: 'post',
url: `http://api.early-birds.fr/tracker/${this.trackerKey}/identify`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here : http/https and api.early-birds.fr --> in a var

document.location.hostname.indexOf(response.cookie.domain) >= 0) {
newProfile.cookie = response.cookie;
}
Cookies.setCookie('eb-profile', JSON.stringify(newProfile));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cookie expire must be defined to 3 months by default. It can be changed through a parameter (SDK configuration or identify parameter). It can also be changed through the API (response.cookie.expire)

package.json Outdated
"axios": "^0.16.2",
"babel-polyfill": "^6.23.0",
"babel-preset-stage-2": "^6.24.1",
"jquery": "^3.2.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependency to jQuery ?

package.json Outdated
"babel-preset-stage-2": "^6.24.1",
"jquery": "^3.2.1",
"lodash": "^4.17.4",
"underscore": "^1.8.3"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both lodash and underscore ? We should reduce the file weight at maximum, so perhaps we don't need those librairies, but at least, we don't need both

@spacewoox spacewoox force-pushed the dev/features_identify_and_trackactivity branch from 7475836 to 85a0a02 Compare September 17, 2017 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants