Skip to content

Commit

Permalink
Discovery Bid Adapter : Extend the expiration time of pmguid (#11154)
Browse files Browse the repository at this point in the history
* Discovery Bid Adapter : add title, desc, keywords, hLen, nbw, hc, dm  add unit test resolve conflict

* Discovery Bid Adapter : add title, desc, keywords, hLen, nbw, hc, dm  add unit test

* Discovery Bid Adapter : synchronize mguid from third party cookie to first party cookie

* test

* Discovery Bid Adapter : Extend the expiration time of pmguid

* Discovery Bid Adapter : Extend the expiration time of pmguid

* Discovery Bid Adapter : Extend the expiration time of pmguid

* Discovery Bid Adapter : Extend the expiration time of pmguid

---------

Co-authored-by: lvhuixin <lvhuixin@baidu.com>
  • Loading branch information
lhxx121 and lvhuixin authored Mar 11, 2024
1 parent 920a36d commit edf27c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions modules/discoveryBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const NATIVERET = {
};

/**
* get page title
* get page title111
* @returns {string}
*/

Expand Down Expand Up @@ -133,10 +133,11 @@ export const getPmgUID = () => {
let pmgUid = storage.getCookie(COOKIE_KEY_PMGUID);
if (!pmgUid) {
pmgUid = utils.generateUUID();
try {
storage.setCookie(COOKIE_KEY_PMGUID, pmgUid, getCurrentTimeToUTCString());
} catch (e) {}
}
// Extend the expiration time of pmguid
try {
storage.setCookie(COOKIE_KEY_PMGUID, pmgUid, getCurrentTimeToUTCString());
} catch (e) {}
return pmgUid;
};

Expand Down
2 changes: 1 addition & 1 deletion test/spec/modules/discoveryBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ describe('discovery:BidAdapterTests', function () {
storage.getCookie.callsFake(() => 'existing-uuid');
const uid = getPmgUID();
expect(uid).to.equal('existing-uuid');
expect(storage.setCookie.called).to.be.false;
expect(storage.setCookie.called).to.be.true;
});

it('should not set new UUID when cookies are not enabled', () => {
Expand Down

0 comments on commit edf27c8

Please sign in to comment.