Skip to content

Commit

Permalink
Add in pixel event for review comment impressions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Kelly committed May 26, 2017
1 parent e790460 commit af33695
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions Pod/BVAnalytics/BVPixelEvents/BVPixelTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ typedef NS_ENUM(NSInteger, BVPixelImpressionContentType) {
BVPixelImpressionContentTypeReview,
BVPixelImpressionContentTypeQuestion,
BVPixelImpressionContentTypeAnswer,
BVPixelImpressionContentTypeComment,
BVPixelImpressionContentProductRecommendation,
BVPixelImpressionContentCurationsFeedItem
};
Expand Down
3 changes: 3 additions & 0 deletions Pod/BVAnalytics/BVPixelEvents/BVPixelTypes.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ +(NSString *)toString:(BVPixelImpressionContentType)contentType{
case BVPixelImpressionContentTypeReview:
return @"Review";
break;
case BVPixelImpressionContentTypeComment:
return @"Comment";
break;
case BVPixelImpressionContentCurationsFeedItem:
return @"SocialPost";
break;
Expand Down
2 changes: 1 addition & 1 deletion Pod/BVConversations/Display/Requests/BVAuthorRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ - (void)loadProfile:(BVConversationsRequest * _Nonnull)request completion:(void
});

if (authorResponse && authorResponse.results){
[ self sendAuthorAnalytics:authorResponse.results.firstObject];
[self sendAuthorAnalytics:authorResponse.results.firstObject];
}

} failure:failure];
Expand Down
28 changes: 24 additions & 4 deletions Pod/BVConversations/Display/Requests/BVCommentsRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
//

#import "BVCommentsRequest.h"
#import "BVImpressionEvent.h"
#import "BVPixel.h"

@implementation BVCommentsRequest

Expand Down Expand Up @@ -62,10 +64,9 @@ - (void)loadComments:(BVConversationsRequest * _Nonnull)request completion:(void
completion(commentsResponse);
});

// TODO: Analytics
// if (authorResponse && authorResponse.results){
// [ self sendAuthorAnalytics:authorResponse.results.firstObject];
// }
if (commentsResponse && commentsResponse.results){
[self sendCommentImpressionAnalytics:commentsResponse.results];
}

} failure:failure];
}
Expand All @@ -74,6 +75,25 @@ - (NSString * _Nonnull)endpoint {
return @"reviewcomments.json";
}

- (void)sendCommentImpressionAnalytics:(NSArray<BVComment*>*)comments {

for (BVComment* comment in comments) {

// Record Review Impression
BVImpressionEvent *commentImpression = [[BVImpressionEvent alloc] initWithProductId:comment.reviewId
withContentId:comment.commentId
withCategoryId:nil
withProductType:BVPixelProductTypeConversationsReviews
withContentType:BVPixelImpressionContentTypeComment
withBrand:nil
withAdditionalParams:nil];

[BVPixel trackEvent:commentImpression];
}


}

- (NSMutableArray * _Nonnull)createParams {

NSMutableArray<BVStringKeyValuePair*>* params = [super createParams];
Expand Down

0 comments on commit af33695

Please sign in to comment.