4

我们对 AB 测试变体的不均衡存在问题。从理论上讲,两种变体的变体应该几乎相同,这实际上与我们之前所做的 AB 测试相当有效。 ab 测试配置 1 ab 测试配置 2

正如您在当前总用户数为 161k 的屏幕截图中所见,变体有 75.4k 和 85.9k。我们已经运行了几次这个测试,对代码进行了细微的修改,但每次都出现了类似的不成比例。

在运行 AB 测试中,我们将远程配置参数“ios_show_recent_searches_v2”空字符串设置为默认值。

使用激活事件运行 ab 测试的代码如下所示:

@objc class FireBaseService: NSObject {
    struct Constants {
        static let recentSearchesABTestToggleKey: String = "ios_show_recent_searches_v2"
        static let abTestNotAvailableKey: String = "N/A"
    }

    @objc class func start() {
        FirebaseApp.configure()
        let remoteConfig = RemoteConfig.remoteConfig()

        let oldShowRecentSearches = showRecentSearches

        remoteConfig.fetch(withExpirationDuration: 0.0) { (status, error) -> Void in
            DispatchQueue.main.async {
                if status == .success {
                    remoteConfig.activateFetched()
                    FireBaseService.notifyRecentSearchesVisiblityChangeIfNeeded(oldValue: oldShowRecentSearches)
                    FireBaseService.sendRecentSearchesActivationEventIfNeeded()
                }
            }
        }
    }  

    private class func hasConfigs(for key: String) -> Bool {
        return (RemoteConfig.remoteConfig()[key].stringValue?.count ?? 0) > 0
    }
}

// MARK: - Recent Searches A/B Test
extension FireBaseService {

    @objc class var showRecentSearchesValue: String {
        if hasConfigs(for: Constants.recentSearchesABTestToggleKey) {
            return RemoteConfig.remoteConfig()[Constants.recentSearchesABTestToggleKey].stringValue ?? Constants.abTestNotAvailableKey
        }
        return Constants.abTestNotAvailableKey
    }

    class var showRecentSearches: Bool {
        return RemoteConfig.remoteConfig()[Constants.recentSearchesABTestToggleKey].boolValue
    }

    private class func sendRecentSearchesActivationEventIfNeeded() {
        if FireBaseService.showRecentSearchesValue != Constants.abTestNotAvailableKey {
            AnalyticsServiceAdapter.activateRecentSearchesExperiment()
        }
    }

    private class func notifyRecentSearchesVisiblityChangeIfNeeded(oldValue: Bool) {
        if oldValue != showRecentSearches {
            NotificationCenter.default.post(name: Notification.Name(FireBaseService.ShowRecentSearchesNotification), object: nil)
        }
    }
}

该函数GEFireBaseService.start在应用程序启动时调用。

4

0 回答 0