Skip to content

Commit

Permalink
Add back user and org tracking on signup
Browse files Browse the repository at this point in the history
  • Loading branch information
nid90 committed Oct 5, 2023
1 parent bf66f37 commit 3dabf5c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions app/controllers/authentication/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Authentication::RegistrationsController < Devise::RegistrationsController
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :set_invite_token, only: [:new, :create]
before_action :set_invite, only: [:new, :create]
after_action :identify_team, only: [:create]
alias_method :user, :resource
helper_method :user

Expand Down Expand Up @@ -97,4 +98,8 @@ def sign_up_params_for_invites
def sign_up_email
sign_up_params[:email]
end

def identify_team
SiteAnalytics.identify_and_group(user.reload, user.reload.organizations.first)
end
end
12 changes: 8 additions & 4 deletions lib/site_analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def self.identify_and_group(user, organization)
identify(user)
group(user, organization)
rescue
nil
Rails.logger.error(e)
Sentry.capture_exception(e)
end

def self.group(user, organization)
Expand All @@ -27,7 +28,8 @@ def self.group(user, organization)
}
)
rescue
nil
Rails.logger.error(e)
Sentry.capture_exception(e)
end

def self.identify(user)
Expand All @@ -40,7 +42,8 @@ def self.identify(user)
}
)
rescue
nil
Rails.logger.error(e)
Sentry.capture_exception(e)
end

def self.track(user, organization, device, event)
Expand All @@ -56,6 +59,7 @@ def self.track(user, organization, device, event)
}
)
rescue
nil
Rails.logger.error(e)
Sentry.capture_exception(e)
end
end

0 comments on commit 3dabf5c

Please sign in to comment.