Skip to content

Commit

Permalink
Merge pull request #2227 from digma-ai/feature/promotion
Browse files Browse the repository at this point in the history
Added promotion
  • Loading branch information
opoliarush authored Jun 18, 2024
2 parents 6cfdff1 + 7d32296 commit b2cee9d
Show file tree
Hide file tree
Showing 13 changed files with 1,555 additions and 243 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,15 @@ class ActivityMonitor(private val project: Project) : Disposable {
)
}

fun registerEmail(email: String) {
postHog?.alias(userId, email)
fun registerEmail(email: String, courseRequested: Boolean) {
postHog?.identify(
userId, mapOf(
"email" to getEmailForEvent(),
INSTALL_STATUS_PROPERTY_NAME to getCurrentInstallStatus()
INSTALL_STATUS_PROPERTY_NAME to getCurrentInstallStatus(),
"user_requested_course" to courseRequested.toString()
)
)
postHog?.alias(userId, email)
}

fun registerCustomEvent(eventName: String, tags: Map<String, Any> = mapOf()) {
Expand Down Expand Up @@ -670,7 +671,8 @@ class ActivityMonitor(private val project: Project) : Disposable {
INSTALL_STATUS_PROPERTY_NAME to getCurrentInstallStatus(),
ENVIRONMENT_ADDED_PROPERTY_NAME to PersistenceService.getInstance().isEnvironmentAdded(),
LOAD_WARNING_APPEARED_PROPERTY_NAME to PersistenceService.getInstance().isLoadWarningAppeared(),
JIRA_FIELD_COPIED_PROPERTY_NAME to PersistenceService.getInstance().isJiraFieldCopied()
JIRA_FIELD_COPIED_PROPERTY_NAME to PersistenceService.getInstance().isJiraFieldCopied(),
"user_requested_course" to "false"
)
)
}
Expand All @@ -695,7 +697,8 @@ class ActivityMonitor(private val project: Project) : Disposable {
INSTALL_STATUS_PROPERTY_NAME to getCurrentInstallStatus(),
ENVIRONMENT_ADDED_PROPERTY_NAME to PersistenceService.getInstance().isEnvironmentAdded(),
LOAD_WARNING_APPEARED_PROPERTY_NAME to PersistenceService.getInstance().isLoadWarningAppeared(),
JIRA_FIELD_COPIED_PROPERTY_NAME to PersistenceService.getInstance().isJiraFieldCopied()
JIRA_FIELD_COPIED_PROPERTY_NAME to PersistenceService.getInstance().isJiraFieldCopied(),
"user_requested_course" to "false"
)
)
}
Expand Down Expand Up @@ -881,11 +884,12 @@ class ActivityMonitor(private val project: Project) : Disposable {
postHog?.identify(
userId,
mapOf(
LOAD_WARNING_APPEARED_PROPERTY_NAME + "_timestamp" to PersistenceService.getInstance().getLoadWarningAppearedTimestamp()
LOAD_WARNING_APPEARED_PROPERTY_NAME + "_timestamp" to PersistenceService.getInstance().getLoadWarningAppearedTimestamp(),
"user_requested_course" to "false"
),
mapOf(
LOAD_WARNING_APPEARED_PROPERTY_NAME to PersistenceService.getInstance().isLoadWarningAppeared()
)
LOAD_WARNING_APPEARED_PROPERTY_NAME to PersistenceService.getInstance().isLoadWarningAppeared(),
),
)

}
Expand All @@ -911,7 +915,8 @@ class ActivityMonitor(private val project: Project) : Disposable {
postHog?.identify(
userId,
mapOf(
ENVIRONMENT_ADDED_PROPERTY_NAME + "_timestamp" to PersistenceService.getInstance().getEnvironmentAddedTimestamp()
ENVIRONMENT_ADDED_PROPERTY_NAME + "_timestamp" to PersistenceService.getInstance().getEnvironmentAddedTimestamp(),
"user_requested_course" to "false"
),
mapOf(
ENVIRONMENT_ADDED_PROPERTY_NAME to PersistenceService.getInstance().isEnvironmentAdded()
Expand Down Expand Up @@ -943,7 +948,8 @@ class ActivityMonitor(private val project: Project) : Disposable {
postHog?.identify(
userId,
mapOf(
JIRA_FIELD_COPIED_PROPERTY_NAME + "_timestamp" to PersistenceService.getInstance().getJiraFieldCopiedTimestamp()
JIRA_FIELD_COPIED_PROPERTY_NAME + "_timestamp" to PersistenceService.getInstance().getJiraFieldCopiedTimestamp(),
"user_requested_course" to "false"
),
mapOf(
JIRA_FIELD_COPIED_PROPERTY_NAME to PersistenceService.getInstance().isJiraFieldCopied()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ class UserRegistrationManager(private val project: Project) {

ActivityMonitor.getInstance(project).registerCustomEvent("register local user", registrationMap)
ActivityMonitor.getInstance(project).registerUserAction("local user registered", registrationMap)
val courseRequested = registrationMap["scope"] == "promotion"


registrationMap["email"]?.let { userEmail ->
PersistenceService.getInstance().setUserRegistrationEmail(userEmail)
ActivityMonitor.getInstance(project).registerEmail(userEmail)//override the onboarding email
ActivityMonitor.getInstance(project).registerEmail(userEmail, courseRequested)//override the onboarding email
project.messageBus.syncPublisher(UserRegistrationEvent.USER_REGISTRATION_TOPIC).userRegistered(userEmail)
} ?: ErrorReporter.getInstance().reportError(
project, "UserRegistrationManager.register", "register user email", mapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import org.digma.intellij.plugin.log.Log
import org.digma.intellij.plugin.persistence.PersistenceService
import org.digma.intellij.plugin.persistence.updateInstallationWizardFlag
import org.digma.intellij.plugin.posthog.ActivityMonitor
import org.digma.intellij.plugin.recentactivity.RecentActivityToolWindowShower
import org.digma.intellij.plugin.ui.MainToolWindowCardsController
import org.digma.intellij.plugin.ui.ToolWindowShower
import org.digma.intellij.plugin.ui.common.isJaegerButtonEnabled
Expand All @@ -67,7 +68,6 @@ import org.digma.intellij.plugin.ui.jcef.serializeAndExecuteWindowPostMessageJav
import org.digma.intellij.plugin.ui.jcef.updateDigmaEngineStatus
import org.digma.intellij.plugin.ui.notificationcenter.AppNotificationCenter
import org.digma.intellij.plugin.ui.panels.DisposablePanel
import org.digma.intellij.plugin.recentactivity.RecentActivityToolWindowShower
import org.digma.intellij.plugin.ui.settings.ApplicationUISettingsChangeNotifier
import org.digma.intellij.plugin.ui.settings.SettingsChangeListener
import org.digma.intellij.plugin.ui.settings.Theme
Expand Down Expand Up @@ -215,7 +215,7 @@ fun createInstallationWizardSidePanelWindowPanel(project: Project, wizardSkipIns
val email = payload?.email
PersistenceService.getInstance().setUserEmail(email)
if (email != null) {
ActivityMonitor.getInstance(project).registerEmail(email)
ActivityMonitor.getInstance(project).registerEmail(email, false)
}

payload?.productKey?.let {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b2cee9d

Please sign in to comment.