-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat: add abtesting module #281
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
模块集成Cocoapods 集成
pod 'GrowingAnalytics/ABTesting' 打开终端,切换到项目目录,执行
Swift Package Manager 集成
模块配置ABTesting 模块中提供了相关配置:
GrowingAutotrackConfiguration *configuration = [GrowingAutotrackConfiguration configurationWithProjectId:@"YourAccountId"];
configuration.dataCollectionServerHost = @"YourServerHost";
configuration.dataSourceId = @"YourDatasourceId";
// ABTesting 配置地址
configuration.abTestingServerHost = @"https://n.datayi.cn";
// 单个实验 TTL 时长
configuration.abTestingRequestInterval = 5;
// 获取实验配置的请求超时时间
GrowingNetworkConfig *networkConfig = [GrowingNetworkConfig config];
networkConfig.abTestingRequestTimeout = 2.0f;
configuration.networkConfig = networkConfig;
[GrowingAutotracker startWithConfiguration:configuration launchOptions:launchOptions]; 获取实验配置根据传入的 layerId,获取实验配置变量 + (void)fetchExperiment:(NSString *)layerId completedBlock:(void (^)(GrowingABTExperiment *_Nullable))completedBlock;
[GrowingABTesting fetchExperiment:@"123456" completedBlock:^(GrowingABTExperiment * _Nullable experiment) {
if (!experiment) {
// 请求失败
return;
}
if (experiment.experimentId.length > 0 && experiment.strategyId.length > 0) {
// 命中实验
// 获取实验配置参数
NSDictionary *variables = experiment.variables;
} else {
// 未命中实验
}
}]; |
YoloMao
force-pushed
the
feat/abtest
branch
2 times, most recently
from
October 26, 2023 07:03
efacaed
to
1575336
Compare
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 5 New issues |
tianhui12
approved these changes
Dec 25, 2023
styluo
approved these changes
Dec 25, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.