Commit 1b3e234c authored by 刘鹿杰's avatar 刘鹿杰

修改referrer_link 参数

parent a68c9258
......@@ -366,7 +366,7 @@ static NSString *sdkVersion = @"110";
[dict setObject:page.pageName forKey:@"page_name"];
[dict setObject:page.businessId?:@"" forKey:@"business_id"];
[dict setObject:page.referer?:@"" forKey:@"referrer"];
[dict setObject:page.refererLink ? : @[] forKey:@"referer_link"];
[dict setObject:page.referrerLink ? : @[] forKey:@"referrer_link"];
[dict setObject:@(0) forKey:@"fake"];
[dict setObject:page.referrerId ? : @"" forKey:@"referrer_id"];
[dict setObject:page.extraParam ? : @"" forKey:@"extra_param"];
......@@ -410,10 +410,12 @@ static NSString *sdkVersion = @"110";
* @since 0.0.1
*/
- (NSDictionary *)prepareDictionaryForEvent:(NSString *)eventId attributes:(NSDictionary *)attributes{
NSArray *refererLink = sharedClient.visibleController.refererLink;
NSMutableDictionary *attributesParams = [NSMutableDictionary dictionaryWithDictionary:attributes];
[attributesParams setValue:refererLink ? : @[] forKey:@"referer_Link"];
attributes = attributesParams;
NSArray *referrerLink = sharedClient.visibleController.referrerLink;
if (![eventId isEqualToString:@"page_view"]) {
NSMutableDictionary *attributesParams = [NSMutableDictionary dictionaryWithDictionary:attributes];
[attributesParams setValue:referrerLink ? : @[] forKey:@"referrer_Link"];
attributes = attributesParams;
}
[self catchNullForEvent:eventId attributes:attributes];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
@try {
......
......@@ -78,7 +78,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
获取上一个页面链路的page_name link by 7.20.0 如果有此页面有page_name则添加 , 没有添加""
*/
@property (nonatomic, copy) NSArray *refererLink;
@property (nonatomic, copy) NSArray *referrerLink;
@end
......
......@@ -55,13 +55,13 @@
// 所以此处要判断,如果是navigation弹出,最后还是要定位到topViewController
if ([me.presentingViewController isKindOfClass:[UINavigationController class]]) {
UIViewController *top = ((UINavigationController *)me.presentingViewController).topViewController;
NSMutableArray *tempRefererLink = [NSMutableArray arrayWithArray:top.refererLink];
[tempRefererLink addObject:top.pageName];
objc_setAssociatedObject(self, @selector(pageLink), tempRefererLink, OBJC_ASSOCIATION_COPY);
NSMutableArray *tempReferrerLink = [NSMutableArray arrayWithArray:top.referrerLink];
[tempReferrerLink addObject:top.pageName];
objc_setAssociatedObject(self, @selector(referrerLink), tempReferrerLink, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
} else {
NSMutableArray *tempRefererLink = [NSMutableArray arrayWithArray:me.presentingViewController.refererLink];
NSMutableArray *tempRefererLink = [NSMutableArray arrayWithArray:me.presentingViewController.referrerLink];
[tempRefererLink addObject:me.presentingViewController.pageName];
objc_setAssociatedObject(self, @selector(pageLink), tempRefererLink, OBJC_ASSOCIATION_COPY);
objc_setAssociatedObject(self, @selector(referrerLink), tempRefererLink, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
} else {
NSArray *navigationPool = ((UIViewController *)self).navigationController.viewControllers;
......@@ -70,20 +70,21 @@
return ;
}
UIViewController *controller = navigationPool[refererIndex];
NSMutableArray *tempRefererLink = [NSMutableArray arrayWithArray:controller.refererLink];
[tempRefererLink addObject:controller.pageName];
objc_setAssociatedObject(self, @selector(refererLink), tempRefererLink, OBJC_ASSOCIATION_COPY);
NSMutableArray *tempReferrerLink = [NSMutableArray arrayWithArray:controller.referrerLink];
[tempReferrerLink addObject:controller.pageName];
objc_setAssociatedObject(self, @selector(referrerLink), tempReferrerLink, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
}
}
- (void)setRefererLink:(NSArray *)refererLink {
objc_setAssociatedObject(self, @selector(refererLink), refererLink, OBJC_ASSOCIATION_COPY);
- (void)setReferrerLink:(NSArray *)referrerLink {
objc_setAssociatedObject(self, @selector(referrerLink), referrerLink, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
-(NSArray *)refererLink {
NSArray *refererLink = objc_getAssociatedObject(self, @selector(refererLink));
return refererLink;
-(NSArray *)referrerLink {
NSArray *referrerLink = objc_getAssociatedObject(self, @selector(referrerLink));
return referrerLink;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment