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

Adds email collection on HuBoard logins #182

Merged
merged 5 commits into from Jan 29, 2016
Merged

Conversation

@discorick
Copy link
Member

discorick commented Jan 29, 2016

Runs an Identify Job on all public and private logins.

Extracted from #177

@discorick discorick force-pushed the discorick/email_collection branch from a6743d3 to 3cadf60 Jan 29, 2016
@dahlbyk

This comment has been minimized.

Copy link
Member

dahlbyk commented Jan 29, 2016

This looks good to me, can we deploy to test environment?

@dahlbyk

This comment has been minimized.

Copy link
Member

dahlbyk commented Jan 29, 2016

Added commit that updates /login permission list to include "Your email".

@dahlbyk

This comment has been minimized.

Copy link
Member

dahlbyk commented Jan 29, 2016

For reference, here's a sample JS payload - we need to make sure we take stuff away server-side that's been provided client-side. More generally, I'm now thinking we should send identify either server-side or client-side, but not both. Could we just move the @user.emails.all call to where we're populating the client-side identify payload when dashboard or boards load?

{
  "anonymousId": "f9275b47-dbb6-4bba-b3f8-db5f871dbefc",
  "context": {
    "page": {
      "path": "/",
      "referrer": "https://github.com/",
      "search": "",
      "title": "HuBoard",
      "url": "http://huboard.rails/"
    },
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36",
    "library": {
      "name": "analytics.js",
      "version": "2.11.1"
    },
    "ip": "192.171.117.210"
  },
  "integrations": {},
  "messageId": "ajs-38a45cd75b84e466b5ddd56d5f7b76d4",
  "receivedAt": "2016-01-29T18:49:39.272Z",
  "sentAt": "2016-01-29T18:49:39.235Z",
  "timestamp": "2016-01-29T18:49:39.271Z",
  "traits": {
    "login": "discorick",
    "id": 1130665,
    "avatar_url": "https://avatars.githubusercontent.com/u/1130665?v=3",
    "gravatar_id": "",
    "site_admin": false,
    "name": null,
    "company": null,
    "email": null
  },
  "type": "identify",
  "userId": "1130665",
  "originalTimestamp": "2016-01-29T18:49:39.234Z"
}

And Ruby:

{
  "userId": "1130665",
  "anonymousId": null,
  "integrations": {},
  "context": {
    "library": {
      "name": "analytics-ruby",
      "version": "2.0.13"
    }
  },
  "traits": {
    "user": {
      "login": "discorick",
      "id": 1130665,
      "avatar_url": "https://avatars.githubusercontent.com/u/1130665?v=3",
      "gravatar_id": "",
      "url": "https://api.github.com/users/discorick",
      "html_url": "https://github.com/discorick",
      "followers_url": "https://api.github.com/users/discorick/followers",
      "following_url": "https://api.github.com/users/discorick/following{/other_user}",
      "gists_url": "https://api.github.com/users/discorick/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/discorick/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/discorick/subscriptions",
      "organizations_url": "https://api.github.com/users/discorick/orgs",
      "repos_url": "https://api.github.com/users/discorick/repos",
      "events_url": "https://api.github.com/users/discorick/events{/privacy}",
      "received_events_url": "https://api.github.com/users/discorick/received_events",
      "type": "User",
      "site_admin": false,
      "name": null,
      "company": null,
      "blog": null,
      "location": null,
      "email": "richardfrank@me.com",
      "hireable": null,
      "bio": null,
      "public_repos": 12,
      "public_gists": 3,
      "followers": 4,
      "following": 1,
      "created_at": "2011-10-15T22:46:18Z",
      "updated_at": "2016-01-23T09:53:08Z",
      "email_verified": true
    },
    "emails": [
      {
        "email": "richardfrank@me.com",
        "primary": true,
        "verified": true
      }
    ],
    "event": "public_login"
  },
  "timestamp": "2016-01-29T18:49:36.522Z",
  "type": "identify",
  "messageId": "96f4d1bb-4c76-405b-a682-453c07453248",
  "writeKey": "xpey0kqbr4",
  "sentAt": "2016-01-29T18:50:11.238Z",
  "receivedAt": "2016-01-29T18:50:11.531Z",
  "originalTimestamp": "2016-01-29T10:49:36.229-08:00"
}
@discorick

This comment has been minimized.

Copy link
Member Author

discorick commented Jan 29, 2016

I would argue that for an identify call, the source of truth should be on the back end. One of the reasons being is many people are using plugins in their browsers these days that interfere with third-party scripts.

@dahlbyk

This comment has been minimized.

Copy link
Member

dahlbyk commented Jan 29, 2016

I would argue that for an identify call, the source of truth should be on the back end. One of the reasons being is many people are using plugins in their browsers these days that interfere with third-party scripts.

👍 I think we're good now that identify is server-only and its userId has been added back to the page payload client-side.

@dahlbyk

This comment has been minimized.

Copy link
Member

dahlbyk commented Jan 29, 2016

(Obligatory observation that LoginPublicJob and LoginPrivateJob are not DRY. But I think we're fine to :shipit: as-is.)

dahlbyk added a commit that referenced this pull request Jan 29, 2016
Adds email collection on HuBoard logins
@dahlbyk dahlbyk merged commit 87123f8 into master Jan 29, 2016
@dahlbyk dahlbyk deleted the discorick/email_collection branch Jan 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.