Skip to content
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

Some keys are needed for snowplow and no via window.sp_* available #206

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions extensions/doPlugins_global.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,12 @@ s._articleViewTypeObj = {

if (!s._utils.isAdWall(s)) {
if (s._utils.isArticlePage()) {
s._articleViewType = s.eVar44 = pageViewEvent;
s.eVar37 = s.prop59 = channel || 'no-entry';
s.eVar38 = s.prop60 = channelCategory;
s._articleViewType = s.eVar44 = window.sp_events = pageViewEvent;
s.eVar37 = s.prop59 = window.sp_m_channel = channel || 'no-entry';
s.eVar38 = s.prop60 = window.sp_m_channel_category = channelCategory;
s._eventsObj.addEvent(pageViewEvent);
this.setPageSourceAndAgeForCheckout(s);
}
}

if (this.isPageViewFromHome(pageViewEvent)) {
s._eventsObj.addEvent('event20');
Expand Down Expand Up @@ -657,11 +657,11 @@ s._setExternalReferringDomainEvents = function (s) {
});
if (isRegexMatch || isDomainMatch) {
s._eventsObj.addEvent(event);
s.eVar44 = s.eVar44 ? s.eVar44 + ',' + event : s.eVar44 = event;
s.eVar37 = s.prop59 = channel || 'no-entry';
s.eVar38 = s.prop60 = channelCategory;
s.eVar44 = window.sp_events = s.eVar44 ? s.eVar44 + ',' + event : s.eVar44 = event;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else condition should contain 'event' instead of ' s.eVar44 = event'. This might be technically working, but isn't right logically and now with the addition of 'window.sp_events' it won't work as desired.

s.eVar44 = window.sp_events = s.eVar44 ? s.eVar44 + ',' + event : event;

s.eVar37 = s.prop59 = window.sp_m_channel = channel || 'no-entry';
s.eVar38 = s.prop60 = window.sp_m_channel_category = channelCategory;
s._articleViewType = s.eVar44;
}
}
});
}
};
Expand Down Expand Up @@ -721,9 +721,9 @@ s._setTrackingValueEvents = function (s) {
channelCategory = 'Other organic Social';
}
s._eventsObj.addEvent(event);
s._articleViewType = s.eVar44 += ',' + event;
s.eVar37 = s.prop59 = channel || 'no-entry';
s.eVar38 = s.prop60 = channelCategory;
s._articleViewType = s.eVar44 = window.sp_events += ',' + event;
s.eVar37 = s.prop59 = window.sp_m_channel = channel || 'no-entry';
s.eVar38 = s.prop60 = window.sp_m_channel_category = channelCategory;
Copy link
Contributor

@mehakraza mehakraza Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is 'no-entry' in channel and 'channelCategory' is not there it will cause undefined results in eVar38, prop60 and sp_m_channel_category. If we don't want to see undefined values we can simply add an empty string instead. Doing this is not mandatory but might be useful.

s.eVar38 = s.prop60 = window.sp_m_channel_category = channelCategory || '';

}
}
}
Expand Down Expand Up @@ -790,9 +790,9 @@ s._homeTeaserTrackingObj = {
const blockValue = this.getBlockValue();
const pageId = this.getPageId();
if (trackingValue) {
s.eVar66 = trackingValue;
s.eVar92 = trackingValue + '|' + pageId;
s.eVar97 = blockValue;
s.eVar66 = window.sp_teaser_position = trackingValue;
s.eVar92 = window.sp_teaser_position_page = trackingValue + '|' + pageId;
s.eVar97 = window.sp_teaser_block = blockValue;
}
},

Expand Down
Loading