Merge pull request #1036 from ncloudioj/gh1034-fix-event-pings
fix (addon): #1034 Fix event ping to include experiment data only if necessary
This commit is contained in:
Коммит
b762e04d40
|
@ -21,9 +21,11 @@ const LinkMenu = React.createClass({
|
|||
page: page,
|
||||
source: source,
|
||||
action_position: index,
|
||||
url: site.recommended ? site.url : null,
|
||||
recommender_type: site.recommended ? site.recommender_type : null
|
||||
};
|
||||
if (site.recommended) {
|
||||
payload.url = site.url;
|
||||
payload.recommender_type = site.recommender_type;
|
||||
}
|
||||
dispatch(actions.NotifyEvent(payload));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -99,15 +99,18 @@ const Spotlight = React.createClass({
|
|||
},
|
||||
onClickFactory(index, site) {
|
||||
return () => {
|
||||
this.props.dispatch(actions.NotifyEvent({
|
||||
let payload = {
|
||||
event: "CLICK",
|
||||
page: this.props.page,
|
||||
source: "FEATURED",
|
||||
action_position: index,
|
||||
highlight_type: site.type,
|
||||
url: site.recommended ? site.url : null,
|
||||
recommender_type: site.recommended ? site.recommender_type : null
|
||||
}));
|
||||
};
|
||||
if (site.recommended) {
|
||||
payload.url = site.url;
|
||||
payload.recommender_type = site.recommender_type;
|
||||
}
|
||||
this.props.dispatch(actions.NotifyEvent(payload));
|
||||
if (site.recommended) {
|
||||
this.props.dispatch(actions.NotifyBlockRecommendation(site.url));
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ describe("Spotlight", function() {
|
|||
assert.equal(a.data.source, "FEATURED");
|
||||
assert.equal(a.data.action_position, 0);
|
||||
assert.equal(a.data.highlight_type, fakeSpotlightItems[0].type);
|
||||
assert.equal(a.data.url, null);
|
||||
assert.equal(a.data.recommender_type, null);
|
||||
assert.equal(a.data.url, undefined);
|
||||
assert.equal(a.data.recommender_type, undefined);
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,13 +48,14 @@ RecommendationProvider.prototype = {
|
|||
* Handle the NEW_RECOMMENDATION event
|
||||
*/
|
||||
_handleNewRecommendationEvent(currentRecommendation) {
|
||||
let url = currentRecommendation ? currentRecommendation.url : null;
|
||||
let recommenderType = currentRecommendation ? currentRecommendation.recommender_type : null;
|
||||
this._tabTracker.handleUserEvent({
|
||||
event: "NEW_RECOMMENDATION",
|
||||
url: url,
|
||||
recommender_type: recommenderType
|
||||
});
|
||||
if (currentRecommendation && currentRecommendation.url &&
|
||||
currentRecommendation.recommender_type) {
|
||||
this._tabTracker.handleUserEvent({
|
||||
event: "NEW_RECOMMENDATION",
|
||||
url: currentRecommendation.url,
|
||||
recommender_type: currentRecommendation.recommender_type
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче