Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion packages/ssr/src/lib/analytics/send-to-awin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const awinAxios = AWIN_ADVERTISER_ID && AWIN_API_KEY
})
: null;

// https://help.awin.com/apidocs/conversion-api - accepted "channel" values
// Expected AwinChannelCookie values — Awin docs mandate 'aw' as the fallback
const validChannels = new Set([
'aw', 'ppcgeneric', 'ppcbrand', 'display', 'social', 'Other', 'Organic', 'direct',
]);
Expand Down
6 changes: 6 additions & 0 deletions packages/storefront/src/analytics/set-tracking-ids.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { setCookie } from '@@sf/sf-lib';

export type TrackingIds = {
gclid?: string,
g_client_id?: string,
Expand Down Expand Up @@ -48,6 +50,10 @@ export const getTrackingIds = (
if (id) {
value = id;
sessionStorage.setItem(`analytics_${key}`, id);
if (key === 'awc') {
// Awin prescribes an awc cookie; sessionStorage doesn't survive a manually-opened tab
setCookie('awc', id, 30);
}
} else {
value = sessionStorage.getItem(`analytics_${key}`) || undefined;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/storefront/src/lib/scripts/vbeta-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import { shoppingCart } from '@@sf/state/shopping-cart';
import { emitGtagEvent, getGtagItem, trackingIds } from '@@sf/state/use-analytics';
import utm from '@@sf/scripts/session-utm';

// https://help.awin.com/apidocs - fallback pixel, redundant to the server-to-server
// Conversion API call already made from send-to-awin.ts
// https://help.awin.com/developers/docs/fall-back-conversion-pixel
// Awin prioritizes one tracking method per order ref, no double-count with the S2S call
const emitAwinFallbackPixel = (orderId: string, amount: number, coupon?: string) => {
if (!window.AWIN_ADVERTISER_ID || !trackingIds.awc) return;
const src = 'https://www.awin1.com/sread.img'
Expand Down