Skip to content

Commit

Permalink
ATS-analytics-adapter - remove envelope source from check, should we …
Browse files Browse the repository at this point in the history
…fire analytics request (#8656)
  • Loading branch information
mamatic authored Jul 7, 2022
1 parent 2009048 commit 1cb6914
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions modules/atsAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function sendDataToAnalytic (events) {
}

// preflight request, to check did publisher have permission to send data to analytics endpoint
function preflightRequest (envelopeSourceCookieValue, events) {
function preflightRequest (events) {
logInfo('ATS Analytics - preflight request!');
ajax(preflightUrl + atsAnalyticsAdapter.context.pid,
{
Expand All @@ -277,7 +277,7 @@ function preflightRequest (envelopeSourceCookieValue, events) {
let samplingRate = samplingRateObject.samplingRate;
atsAnalyticsAdapter.setSamplingCookie(samplingRate);
let samplingRateNumber = Number(samplingRate);
if (data && samplingRate && atsAnalyticsAdapter.shouldFireRequest(samplingRateNumber) && envelopeSourceCookieValue != null) {
if (data && samplingRate && atsAnalyticsAdapter.shouldFireRequest(samplingRateNumber)) {
logInfo('ATS Analytics - events to send: ', events);
sendDataToAnalytic(events);
}
Expand Down Expand Up @@ -377,12 +377,11 @@ atsAnalyticsAdapter.callHandler = function (evtype, args) {
}
// check should we send data to analytics or not, check first cookie value _lr_sampling_rate
try {
let envelopeSourceCookieValue = storage.getCookie('_lr_env_src_ats');
let samplingRateCookie = storage.getCookie('_lr_sampling_rate');
if (!samplingRateCookie) {
preflightRequest(envelopeSourceCookieValue, events);
preflightRequest(events);
} else {
if (atsAnalyticsAdapter.shouldFireRequest(parseInt(samplingRateCookie)) && envelopeSourceCookieValue != null) {
if (atsAnalyticsAdapter.shouldFireRequest(parseInt(samplingRateCookie))) {
logInfo('ATS Analytics - events to send: ', events);
sendDataToAnalytic(events);
}
Expand Down

0 comments on commit 1cb6914

Please sign in to comment.