Skip to content

Commit

Permalink
feat: bootcamps page anlytics
Browse files Browse the repository at this point in the history
  • Loading branch information
chtzvt committed Dec 31, 2023
1 parent 2e0173b commit 67447f8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Procfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ worker: bundle exec sidekiq
js: yarn build --watch
css: yarn build:css --watch
redesign: yarn build:redesign --watch
stripe: stripe listen --forward-to localhost:3000/pay/webhooks/stripe
#stripe: stripe listen --forward-to localhost:3000/pay/webhooks/stripe
1 change: 1 addition & 0 deletions app/controllers/bootcamps_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class BootcampsController < ApplicationController
def show
Analytics::Event.bootcamps_page_viewed(current_user, cookies)
end
end
18 changes: 18 additions & 0 deletions app/models/analytics/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,24 @@ def self.about_page_viewed(user, cookies)
)
end

def self.bootcamps_page_viewed(user, cookies)
if user.nil?
return
end

SegmentClient.track(
user_id: user.analytics_profile[:ap_stable_id],
anonymous_id: cookies[:uuid],
event: "bootcamps_page_viewed",
properties: {
user: {
**user.analytics_profile,
**user.attributes
}
}
)
end

def self.tos_page_viewed(user, cookies)
if user.nil?
return
Expand Down

0 comments on commit 67447f8

Please sign in to comment.