From f0d118a054989048fb83aef71e79789563ae3d17 Mon Sep 17 00:00:00 2001 From: Joshuah Ciafardone <107969016+jciafardone@users.noreply.github.com> Date: Fri, 5 Dec 2025 17:34:06 -0800 Subject: [PATCH 1/5] Update integrationCapture.ts to include Pinterest Add Pinterest _epik parameter mapping to integrationMappingExternal. - Maps _epik to Pinterest.click_id custom flag - Supports capture from URL query params, cookies, and localStorage - Follows standard priority: query params > localStorage > cookies - Outputs to CUSTOM_FLAGS (same as other click ID integrations) Reference: https://help.pinterest.com/en/business/article/add-event-codes Testing: - Verified extraction from URL, cookie, and localStorage sources - Confirmed priority resolution works correctly - Validated custom flag mapping to Pinterest.click_id --- src/integrationCapture.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/integrationCapture.ts b/src/integrationCapture.ts index 419228efc..5929e7b35 100644 --- a/src/integrationCapture.ts +++ b/src/integrationCapture.ts @@ -120,6 +120,13 @@ const integrationMappingExternal: IntegrationIdMapping = { mappedKey: 'SnapchatConversions.ClickId', output: IntegrationOutputs.CUSTOM_FLAGS, }, + + // Pinterest + // https://help.pinterest.com/en/business/article/add-event-codes + _epik: { + mappedKey: 'Pinterest.click_id', + output: IntegrationOutputs.CUSTOM_FLAGS, + }, }; const integrationMappingRokt: IntegrationIdMapping = { From 20e5c56fd06dbc1254ea9e2a35836a3333d691c0 Mon Sep 17 00:00:00 2001 From: Joshuah Ciafardone Date: Tue, 9 Dec 2025 14:07:27 -0800 Subject: [PATCH 2/5] test: add Pinterest _epik click ID tests --- test/jest/integration-capture.spec.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/jest/integration-capture.spec.ts b/test/jest/integration-capture.spec.ts index 875179bb2..cb92492d1 100644 --- a/test/jest/integration-capture.spec.ts +++ b/test/jest/integration-capture.spec.ts @@ -27,7 +27,8 @@ describe('Integration Capture', () => { 'gbraid', 'wbraid', 'ttclid', - 'ScCid' + 'ScCid', + '_epik' ]); }); @@ -275,6 +276,22 @@ describe('Integration Capture', () => { }); }); + describe('Pinterest Click Ids', () => { + it('should capture Pinterest specific click ids', () => { + const url = new URL('https://www.example.com/?_epik=1234'); + + window.location.href = url.href; + window.location.search = url.search; + + const integrationCapture = new IntegrationCapture('all'); + integrationCapture.capture(); + + expect(integrationCapture.clickIds).toEqual({ + _epik: '1234', + }); + }); + }); + describe('Facebook Click Ids', () => { it('should format fbclid correctly', () => { jest.spyOn(Date, 'now').mockImplementation(() => 42); @@ -665,6 +682,7 @@ describe('Integration Capture', () => { _ttp: '0823422223.23234', ttclid: '12345', gclid: '123233.23131', + _epik: 'pinterest123', invalidId: '12345', }; @@ -675,6 +693,7 @@ describe('Integration Capture', () => { 'Facebook.BrowserId': '54321', 'TikTok.Callback': '12345', 'GoogleEnhancedConversions.Gclid': '123233.23131', + 'Pinterest.click_id': 'pinterest123', }); }); }); From 6b060f0e98db0abd8ea7ad4f956c63ea59d934e3 Mon Sep 17 00:00:00 2001 From: Joshuah Ciafardone Date: Tue, 9 Dec 2025 14:32:55 -0800 Subject: [PATCH 3/5] test: add Pinterest _epik tests for cookies and localStorage --- test/jest/integration-capture.spec.ts | 33 ++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/test/jest/integration-capture.spec.ts b/test/jest/integration-capture.spec.ts index cb92492d1..3b1e1d06e 100644 --- a/test/jest/integration-capture.spec.ts +++ b/test/jest/integration-capture.spec.ts @@ -277,7 +277,7 @@ describe('Integration Capture', () => { }); describe('Pinterest Click Ids', () => { - it('should capture Pinterest specific click ids', () => { + it('should capture Pinterest specific click ids from query params', () => { const url = new URL('https://www.example.com/?_epik=1234'); window.location.href = url.href; @@ -290,6 +290,37 @@ describe('Integration Capture', () => { _epik: '1234', }); }); + + it('should capture Pinterest specific click ids from cookies', () => { + const url = new URL('https://www.example.com/'); + + window.document.cookie = '_epik=pinterest_cookie_value'; + window.location.href = url.href; + window.location.search = url.search; + + const integrationCapture = new IntegrationCapture('all'); + integrationCapture.capture(); + + expect(integrationCapture.clickIds).toEqual({ + _epik: 'pinterest_cookie_value', + }); + }); + + it('should capture Pinterest specific click ids from localStorage', () => { + const url = new URL('https://www.example.com/'); + + window.location.href = url.href; + window.location.search = url.search; + + localStorage.setItem('_epik', 'pinterest_localstorage_value'); + + const integrationCapture = new IntegrationCapture('all'); + integrationCapture.capture(); + + expect(integrationCapture.clickIds).toEqual({ + _epik: 'pinterest_localstorage_value', + }); + }); }); describe('Facebook Click Ids', () => { From e11cf61841a69139045b8b04f951ff3dbdaabcb9 Mon Sep 17 00:00:00 2001 From: Joshuah Ciafardone <107969016+jciafardone@users.noreply.github.com> Date: Wed, 17 Dec 2025 13:22:46 -0800 Subject: [PATCH 4/5] Update src/integrationCapture.ts Co-authored-by: Alex S <49695018+alexs-mparticle@users.noreply.github.com> --- src/integrationCapture.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/integrationCapture.ts b/src/integrationCapture.ts index 5929e7b35..428edbd4d 100644 --- a/src/integrationCapture.ts +++ b/src/integrationCapture.ts @@ -122,7 +122,7 @@ const integrationMappingExternal: IntegrationIdMapping = { }, // Pinterest - // https://help.pinterest.com/en/business/article/add-event-codes + // https://help.pinterest.com/en/business/article/pinterest-tag-parameters-and-cookies _epik: { mappedKey: 'Pinterest.click_id', output: IntegrationOutputs.CUSTOM_FLAGS, From 2dfa771081d0db277bced1cbbc1355567aaa1d8d Mon Sep 17 00:00:00 2001 From: Joshuah Ciafardone Date: Wed, 17 Dec 2025 14:09:46 -0800 Subject: [PATCH 5/5] feat: add support for Pinterest epik parameter (without underscore) - Add epik parameter mapping in addition to _epik - Both epik and _epik map to Pinterest.click_id custom flag - Support capture from query params, cookies, and localStorage - Add comprehensive tests for both parameter variants - Reference: https://developers.pinterest.com/docs/track-conversions/track-conversions-in-the-api/ --- src/integrationCapture.ts | 6 +++ test/jest/integration-capture.spec.ts | 69 +++++++++++++++++++++++++-- 2 files changed, 71 insertions(+), 4 deletions(-) diff --git a/src/integrationCapture.ts b/src/integrationCapture.ts index 428edbd4d..c7162ea1e 100644 --- a/src/integrationCapture.ts +++ b/src/integrationCapture.ts @@ -123,6 +123,12 @@ const integrationMappingExternal: IntegrationIdMapping = { // Pinterest // https://help.pinterest.com/en/business/article/pinterest-tag-parameters-and-cookies + // https://help.pinterest.com/en/business/article/add-event-codes + // https://developers.pinterest.com/docs/track-conversions/track-conversions-in-the-api/ + epik: { + mappedKey: 'Pinterest.click_id', + output: IntegrationOutputs.CUSTOM_FLAGS, + }, _epik: { mappedKey: 'Pinterest.click_id', output: IntegrationOutputs.CUSTOM_FLAGS, diff --git a/test/jest/integration-capture.spec.ts b/test/jest/integration-capture.spec.ts index 3b1e1d06e..a62a6bfa9 100644 --- a/test/jest/integration-capture.spec.ts +++ b/test/jest/integration-capture.spec.ts @@ -28,6 +28,7 @@ describe('Integration Capture', () => { 'wbraid', 'ttclid', 'ScCid', + 'epik', '_epik' ]); }); @@ -277,7 +278,7 @@ describe('Integration Capture', () => { }); describe('Pinterest Click Ids', () => { - it('should capture Pinterest specific click ids from query params', () => { + it('should capture Pinterest specific click ids from query params (_epik)', () => { const url = new URL('https://www.example.com/?_epik=1234'); window.location.href = url.href; @@ -291,7 +292,21 @@ describe('Integration Capture', () => { }); }); - it('should capture Pinterest specific click ids from cookies', () => { + it('should capture Pinterest specific click ids from query params (epik)', () => { + const url = new URL('https://www.example.com/?epik=5678'); + + window.location.href = url.href; + window.location.search = url.search; + + const integrationCapture = new IntegrationCapture('all'); + integrationCapture.capture(); + + expect(integrationCapture.clickIds).toEqual({ + epik: '5678', + }); + }); + + it('should capture Pinterest specific click ids from cookies (_epik)', () => { const url = new URL('https://www.example.com/'); window.document.cookie = '_epik=pinterest_cookie_value'; @@ -306,7 +321,22 @@ describe('Integration Capture', () => { }); }); - it('should capture Pinterest specific click ids from localStorage', () => { + it('should capture Pinterest specific click ids from cookies (epik)', () => { + const url = new URL('https://www.example.com/'); + + window.document.cookie = 'epik=pinterest_cookie_value_epik'; + window.location.href = url.href; + window.location.search = url.search; + + const integrationCapture = new IntegrationCapture('all'); + integrationCapture.capture(); + + expect(integrationCapture.clickIds).toEqual({ + epik: 'pinterest_cookie_value_epik', + }); + }); + + it('should capture Pinterest specific click ids from localStorage (_epik)', () => { const url = new URL('https://www.example.com/'); window.location.href = url.href; @@ -321,6 +351,22 @@ describe('Integration Capture', () => { _epik: 'pinterest_localstorage_value', }); }); + + it('should capture Pinterest specific click ids from localStorage (epik)', () => { + const url = new URL('https://www.example.com/'); + + window.location.href = url.href; + window.location.search = url.search; + + localStorage.setItem('epik', 'pinterest_localstorage_value_epik'); + + const integrationCapture = new IntegrationCapture('all'); + integrationCapture.capture(); + + expect(integrationCapture.clickIds).toEqual({ + epik: 'pinterest_localstorage_value_epik', + }); + }); }); describe('Facebook Click Ids', () => { @@ -713,7 +759,7 @@ describe('Integration Capture', () => { _ttp: '0823422223.23234', ttclid: '12345', gclid: '123233.23131', - _epik: 'pinterest123', + epik: 'pinterest123', invalidId: '12345', }; @@ -727,6 +773,21 @@ describe('Integration Capture', () => { 'Pinterest.click_id': 'pinterest123', }); }); + + it('should map both epik and _epik to Pinterest.click_id', () => { + const integrationCapture = new IntegrationCapture('all'); + integrationCapture.clickIds = { + epik: 'pinterest_epik', + _epik: 'pinterest_underscore_epik', + }; + + const customFlags = integrationCapture.getClickIdsAsCustomFlags(); + + // Both map to the same key, last one wins (based on object iteration order) + expect(customFlags).toHaveProperty('Pinterest.click_id'); + // The value will be one of them depending on iteration order + expect(['pinterest_epik', 'pinterest_underscore_epik']).toContain(customFlags['Pinterest.click_id']); + }); }); describe('#getClickIdsAsPartnerIdentites', () => {