From 2ead62c9f198253baab514ec9a8f9e553bf77f35 Mon Sep 17 00:00:00 2001 From: rfortmann-fd <115005095+rfortmann-fd@users.noreply.github.com> Date: Fri, 9 Dec 2022 12:05:53 +0100 Subject: [PATCH] Preview mode changes the API endpoint As specified in that (documentation)[https://businesshelp.snapchat.com/s/article/capi-event-testing?language=en_US], the endpoint is else when you want to validate the test events. That commit changes the endpoint automatically when the preview mode is activated. --- template.tpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/template.tpl b/template.tpl index a6e9fde..78cdce4 100644 --- a/template.tpl +++ b/template.tpl @@ -397,8 +397,13 @@ function createUUID() { } const eventData = getAllEventData(); +const containerVersion = getContainerVersion(); +const isPreview = containerVersion.previewMode; -const postUrl = 'https://tr.snapchat.com/v2/conversion'; +let postUrl = 'https://tr.snapchat.com/v2/conversion'; +if(isPreview){ + postUrl = postUrl + '/validate'; +} function getCookie1() { const existingCookie1 = getCookieValues('_scid')[0];