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

Add additional tracking for remote install #8321

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import android.support.v7.app.AppCompatActivity
import android.view.MenuItem
import kotlinx.android.synthetic.main.toolbar.*
import org.wordpress.android.R
import org.wordpress.android.analytics.AnalyticsTracker.Stat.INSTALL_JETPACK_CANCELLED
import org.wordpress.android.ui.JetpackConnectionUtils.trackWithSource
import org.wordpress.android.ui.JetpackRemoteInstallFragment.Companion.TRACKING_SOURCE_KEY

class JetpackRemoteInstallActivity : AppCompatActivity() {
public override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -27,4 +30,12 @@ class JetpackRemoteInstallActivity : AppCompatActivity() {
}
return super.onOptionsItemSelected(item)
}

override fun onBackPressed() {
trackWithSource(
INSTALL_JETPACK_CANCELLED,
intent.getSerializableExtra(TRACKING_SOURCE_KEY) as JetpackConnectionSource
)
super.onBackPressed()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.ViewModel
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.wordpress.android.analytics.AnalyticsTracker
import org.wordpress.android.fluxc.Dispatcher
import org.wordpress.android.fluxc.generated.JetpackActionBuilder
import org.wordpress.android.fluxc.model.SiteModel
Expand Down Expand Up @@ -89,12 +90,15 @@ class JetpackRemoteInstallViewModel
fun onEventsUpdated(event: OnJetpackInstalled) {
val site = siteModel ?: return
if (event.isError) {
AnalyticsTracker.track(AnalyticsTracker.Stat.INSTALL_JETPACK_REMOTE_FAILED)
mutableViewState.postValue(Error { startRemoteInstall(site) })
return
}
if (event.success) {
AnalyticsTracker.track(AnalyticsTracker.Stat.INSTALL_JETPACK_REMOTE_COMPLETED)
mutableViewState.postValue(Installed { connectJetpack(site.id) })
} else {
AnalyticsTracker.track(AnalyticsTracker.Stat.INSTALL_JETPACK_REMOTE_FAILED)
mutableViewState.postValue(Error { startRemoteInstall(site) })
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ public enum Stat {
INSTALL_JETPACK_SELECTED,
INSTALL_JETPACK_CANCELLED,
INSTALL_JETPACK_COMPLETED,
INSTALL_JETPACK_REMOTE_COMPLETED,
INSTALL_JETPACK_REMOTE_FAILED,
CONNECT_JETPACK_SELECTED,
CONNECT_JETPACK_FAILED,
PUSH_NOTIFICATION_RECEIVED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,10 @@ public static String getEventNameForStat(AnalyticsTracker.Stat stat) {
return "install_jetpack_canceled";
case INSTALL_JETPACK_COMPLETED:
return "install_jetpack_completed";
case INSTALL_JETPACK_REMOTE_COMPLETED:
return "install_jetpack_remote_completed";
case INSTALL_JETPACK_REMOTE_FAILED:
return "connect_jetpack_remote_failed";
case CONNECT_JETPACK_SELECTED:
return "connect_jetpack_selected";
case CONNECT_JETPACK_FAILED:
Expand Down