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

Enable FullStory for users on the PERSONAL30 plan #13753

Merged
merged 21 commits into from
Apr 10, 2018

Conversation

alonsogarciapablo
Copy link
Contributor

@alonsogarciapablo alonsogarciapablo commented Mar 23, 2018

I was missing some sessions in FullStory. It turns out it was enabled for everyone on the signup flow (commercial site), but only enabled for users on the FREE plan in Dashboard / Builder.

This PR introduces some tweaks to the FullStory setup:

  1. FS will only be enabled for users who signed up after 2017-01-01.
  2. FS will be enabled for FREE and PERSONAL30 users, so that we can record the first sessions of users.
  3. FS will be enabled in the Dataset view but the contents of the cells will be excluded from the recordings, as they might contain sensitive data (https://help.fullstory.com/technical-questions/exclude-elements).
  4. FS will also be tracking accountType in Dashboard / Builder / Dataset view.

There has been some discussion about this in https://github.com/CartoDB/cartodb-management/issues/5020.

cc: @piensaenpixel @arianaescobar

@@ -119,7 +119,7 @@ def insert_hubspot_form(form = 'newsletter')

def insert_fullstory
if Cartodb.get_config(:fullstory, 'org').present? && current_user &&
current_user.account_type.casecmp('FREE').zero? && params[:cookies] != '0'
['FREE','PERSONAL30'].include?(current_user.account_type.upcase) && params[:cookies] != '0'

Choose a reason for hiding this comment

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

Align the operands of a condition in an if statement spanning multiple lines.
Space missing after comma.

Pablo Alonso Garcia added 2 commits March 23, 2018 16:49
@arianaescobar
Copy link

Wait wait wait, we can't do this.

@arianaescobar
Copy link

@alonsogarciapablo
Copy link
Contributor Author

Thanks @arianaescobar! I will take a look and make sure this won't put us all in jail! 😂

Pablo Alonso Garcia added 2 commits March 27, 2018 15:58
- Make sure that FullStory is only enabled for users who accepted
  the Terms of Service and Privacy Polity during the signup process.
- Enable FullStory in the Dataset page, filtering out sensitive data.
if fullstory_org.present? &&
user_plan_supported &&
user_signed_up_after_min_signed_up_date &&
params[:cookies] != '0'

Choose a reason for hiding this comment

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

Align the operands of a condition in an if statement spanning multiple lines.

current_user.created_at > min_signed_up_date

if fullstory_org.present? &&
user_plan_supported &&

Choose a reason for hiding this comment

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

Align the operands of a condition in an if statement spanning multiple lines.

user_plan_supported = current_user &&
['FREE', 'PERSONAL30'].include?(current_user.account_type.upcase)
user_signed_up_after_min_signed_up_date = current_user &&
current_user.created_at > min_signed_up_date

Choose a reason for hiding this comment

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

Align the operands of an expression in an assignment spanning multiple lines.

min_signed_up_date = Date.new(2017,01,01)
fullstory_org = Cartodb.get_config(:fullstory, 'org')
user_plan_supported = current_user &&
['FREE', 'PERSONAL30'].include?(current_user.account_type.upcase)

Choose a reason for hiding this comment

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

Align the operands of an expression in an assignment spanning multiple lines.

# which is the date where a message to accept the Terms and
# conditions and the Privacy policy was included in the Signup page.
# See https://github.com/CartoDB/cartodb-central/commit/3627da19f071c8fdd1604ddc03fb21ab8a6dff9f
min_signed_up_date = Date.new(2017,01,01)

Choose a reason for hiding this comment

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

Space missing after comma.
Use 0o for octal literals.

@alonsogarciapablo alonsogarciapablo removed the request for review from javitonino March 28, 2018 13:29
@CartoDB CartoDB deleted a comment from houndci-bot Mar 28, 2018
@alonsogarciapablo
Copy link
Contributor Author

Talked to @agnesgyorfi about this and made some changes to the PR. I updated the PR description and explained there how it works now.


if fullstory_org.present? &&
user_plan_supported &&
user_signed_up_after_min_signed_up_date &&

Choose a reason for hiding this comment

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

Align the operands of a condition in an if statement spanning multiple lines.

Copy link
Contributor

@javitonino javitonino left a comment

Choose a reason for hiding this comment

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

Please, apply Hound suggestions. Also, consider:

  • We have 120 column lines in Ruby. Use them! ;)
  • You could do a return unless current_user at the beginning of the method and avoid a couple of current_user checks.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

.rubocop.yml: Lint/EndAlignment has the wrong namespace - should be Layout
.rubocop.yml: Lint/EndAlignment has the wrong namespace - should be Layout
.rubocop.yml: Lint/DefEndAlignment has the wrong namespace - should be Layout
.rubocop.yml: Lint/BlockAlignment has the wrong namespace - should be Layout
.rubocop.yml: Lint/ConditionPosition has the wrong namespace - should be Layout
Error: The `Style/TrailingCommaInLiteral` cop no longer exists. Please use `Style/TrailingCommaInArrayLiteral` and/or `Style/TrailingCommaInHashLiteral` instead.
(obsolete configuration found in .rubocop.yml, please update it)

# which is the date where a message to accept the Terms and
# conditions and the Privacy policy was included in the Signup page.
# See https://github.com/CartoDB/cartodb-central/commit/3627da19f071c8fdd1604ddc03fb21ab8a6dff9f
min_signed_up_date = Date.new(2017, 01, 01)

Choose a reason for hiding this comment

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

Use 0o for octal literals.

@alonsogarciapablo
Copy link
Contributor Author

Thanks for your feedback @javitonino! I changed the code a bit in a892a81.

min_signed_up_date = Date.new(2017, 01, 01)
fullstory_org = Cartodb.get_config(:fullstory, 'org')
user_plan_supported = ['FREE', 'PERSONAL30'].include?(current_user.account_type.upcase)
user_signed_up_after_min_signed_up_date = current_user.created_at > min_signed_up_date
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@javitonino I noticed a similar logic exists here. It looks like in other places we use the fullstoryEnabled variable to determine if FullStory is enabled. Basically: here and here. I have no idea what those files are being used for, but it seems that we need to DRY this up a bit.

@javitonino javitonino self-assigned this Apr 10, 2018
# which is the date where a message to accept the Terms and
# conditions and the Privacy policy was included in the Signup page.
# See https://github.com/CartoDB/cartodb-central/commit/3627da19f071c8fdd1604ddc03fb21ab8a6dff9f
FULLSTORY_ENABLED_MIN_DATE = Date.new(2017, 01, 01)

Choose a reason for hiding this comment

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

Use 0o for octal literals.

# which is the date where a message to accept the Terms and
# conditions and the Privacy policy was included in the Signup page.
# See https://github.com/CartoDB/cartodb-central/commit/3627da19f071c8fdd1604ddc03fb21ab8a6dff9f
FULLSTORY_ENABLED_MIN_DATE = Date.new(2017, 01, 01)

Choose a reason for hiding this comment

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

Use 0o for octal literals.

@@ -6,6 +6,7 @@ module FrontendConfigHelper
UPGRADE_LINK_ACCOUNT = 'PERSONAL30'.freeze

def frontend_config_hash(user = current_user)
byebug

Choose a reason for hiding this comment

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

Remove debugger entry point byebug.

@@ -643,6 +650,10 @@ def locked?
state == STATE_LOCKED
end

def fullstory_enabled?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about moving this logic to the user too. Love it. 👏👏👏

Copy link
Contributor Author

@alonsogarciapablo alonsogarciapablo Apr 10, 2018

Choose a reason for hiding this comment

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

Perhaps worth extracting this logic to a module (concern?) that both Carto::User and User can share? There's the risk of someone changing this logic in only one place otherwise...

Copy link
Contributor

Choose a reason for hiding this comment

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

No need. This is the standard approach for duplicated Sequel/AR models, we just copy funcionality. We are always aware we need to change it at both places. And it's just another reason to finally deprecate the Sequel model :D

@@ -0,0 +1,11 @@
module FullstoryHelper
def fullstory_enabled?(user)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I personally think this helper would read better if we inverse the order of these two methods.

@alonsogarciapablo
Copy link
Contributor Author

@agnesgyorfi FYI: this is how the Dataset view looks like in FS recordings (content of cells are greyed out):

screen shot 2018-04-10 at 13 49 08

@alonsogarciapablo alonsogarciapablo merged commit f8b8923 into master Apr 10, 2018
@alonsogarciapablo alonsogarciapablo deleted the fullstory-for-personal30 branch April 10, 2018 15:21
@alonsogarciapablo
Copy link
Contributor Author

Deployin' 🚀

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.

4 participants