Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix to Prod: DL purchase event; adding ecommerce object and currency value #246

Merged
merged 41 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
fb0871d
#181 Fix styles of pet-tags/tag-quote and pet-tags/tag-select (#182)
miakobchuk Aug 6, 2024
7ad2286
hotfix for change domain
miakobchuk Aug 7, 2024
4c4d79b
adding additional environment entry to config
miakobchuk Aug 8, 2024
19b96ad
updated trusted site block
miakobchuk Aug 8, 2024
7c16136
Menu links refactoring (#188)
miakobchuk Aug 9, 2024
760d840
PM-361
miakobchuk Aug 13, 2024
ec80ebd
PM-361
miakobchuk Aug 13, 2024
61de609
Merge remote-tracking branch 'refs/remotes/origin/stage' into develop
BaDos Aug 14, 2024
4f3a98a
updated document-based footer
miakobchuk Aug 16, 2024
c646d3a
added x icon for footer
miakobchuk Aug 16, 2024
dd27d15
removed external icon for petmicrochiplookup.org link
miakobchuk Aug 16, 2024
472442a
Merge remote-tracking branch 'refs/remotes/origin/stage' into develop
BaDos Aug 22, 2024
3f7a07e
Merge remote-tracking branch 'refs/remotes/origin/main' into stage
BaDos Aug 30, 2024
433f2fd
Merge remote-tracking branch 'refs/remotes/origin/stage' into develop
BaDos Aug 30, 2024
9b9a03e
Merge remote-tracking branch 'refs/remotes/origin/main' into stage
BaDos Sep 10, 2024
941bf8c
Merge remote-tracking branch 'refs/remotes/origin/stage' into develop
BaDos Sep 10, 2024
ba32c40
24PW: Post Purchase Thank You Page - EDS Build (#201)
hero-dokane Sep 11, 2024
ef8d162
24PW: Post Purchase Thank You Page - EDS Build - QA Feedback Updates …
hero-dokane Sep 12, 2024
dc21b70
24PW: Post Purchase Thank You Page - EDS Build - QA Feedback Updates …
hero-dokane Sep 13, 2024
f155c78
Fixes for the form issues (#205)
BaDos Sep 16, 2024
d06bf4d
Feature/post purchase thank you page (#206)
hero-dokane Sep 16, 2024
9217777
Sync develop into stage (#207)
BaDos Sep 16, 2024
9c7dc18
24PW: Membership V2 Paid Page - EDS Build (#208)
hero-dokane Sep 17, 2024
e386258
24PW: Membership V2 Paid Page - QA Updates (#209)
hero-dokane Sep 17, 2024
9dc8710
Add page /paid/lost-pet-protection (#194)
hero-dokane Sep 18, 2024
1f49990
24PW: Membership V2 Paid Page - QA Updates (#211)
hero-dokane Sep 18, 2024
95c0d6b
Fix config matching (#212)
BaDos Sep 18, 2024
510df5e
Merge remote-tracking branch 'origin/stage' into develop
BaDos Sep 18, 2024
866cd49
24PW: Lost Pet Recovery Paid Page - EDS Build (#210)
hero-dokane Sep 18, 2024
d53e374
Sync develop into stage (#213)
BaDos Sep 18, 2024
909c0f5
Sync develop into stage (#213) (#214)
BaDos Sep 18, 2024
9f26a83
Fix css (#216)
BaDos Sep 25, 2024
510aede
Merge branch 'develop' into stage
fe-lix- Sep 25, 2024
c1a242e
Merge remote-tracking branch 'origin/main' into stage
BaDos Oct 3, 2024
316c81e
Sync develop into stage (#220)
hero-dokane Oct 4, 2024
d533307
Sync develop into stage (#223)
hero-dokane Oct 7, 2024
d5d7dbe
Sync develop into stage (#227)
hero-dokane Oct 8, 2024
1b08b7c
Sync develop into stage (#231)
pgilmore-phi Oct 11, 2024
b99d1fe
Back Sync stage with main (#233)
pgilmore-phi Oct 15, 2024
879d52e
Adding currency to purchase event DL
pgilmore-phi Oct 18, 2024
3d758e1
Merge branch 'stage' into hotfix/PM-618-DL-purchase-event-mod
pgilmore-phi Oct 18, 2024
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
29 changes: 18 additions & 11 deletions blocks/thank-you/thank-you.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import APIClient, { getAPIBaseUrl } from '../../scripts/24petwatch-api.js';
import {
COOKIE_NAME_SAVED_OWNER_ID,
deleteCookie,
CURRENCY_CANADA,
CURRENCY_US,
} from '../../scripts/24petwatch-utils.js';
import { isCanada } from '../../scripts/lib-franklin.js';
import { trackGTMEvent } from '../../scripts/lib-analytics.js';

// prep for API calls
Expand Down Expand Up @@ -91,6 +94,7 @@ export default async function decorate() {
const paymentProcessorId = urlParams.get('PaymentProcessorCustomerId');
const data = await getPaymentCustomerIDFromUUID(paymentProcessorId);
let getOwnerDetails = await getOwner(data.paymentPortalCustomerId);
const currencyValue = isCanada ? CURRENCY_CANADA : CURRENCY_US;

await putUpdateOwnerSaleStatus(getOwnerDetails.id);

Expand Down Expand Up @@ -157,17 +161,20 @@ export default async function decorate() {
contentColumn.appendChild(totals);

const trackingData = {
microchip_number: petSummaries[0].microChipNumber,
product_type: petSummaries[0].membershipName,
transaction_id: externalTransactionID,
affiliation: '24petwatch',
tax: summary.salesTaxes,
payment_type: paymentMethod,
value: summary.totalDueToday,
shipping: petSummaries[0].nonInsurancePetSummary.shipping,
coupon: nonInsPromoCode,
flow: cartFlow,
customerid: getOwnerDetails.id,
ecommerce: {
microchip_number: petSummaries[0].microChipNumber,
product_type: petSummaries[0].membershipName,
transaction_id: externalTransactionID,
affiliation: '24petwatch',
tax: summary.salesTaxes,
payment_type: paymentMethod,
value: summary.totalDueToday,
currency: currencyValue,
shipping: petSummaries[0].nonInsurancePetSummary.shipping,
coupon: nonInsPromoCode,
flow: cartFlow,
customerid: getOwnerDetails.id,
},
};

// send the GTM event
Expand Down
3 changes: 3 additions & 0 deletions scripts/24petwatch-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export const MICROCHIP_REGEX = /^([A-Z0-9]{15}|[A-Z0-9]{10}|[A-Z0-9]{9})$/i;
export const POSTAL_CODE_CANADA_REGEX = /^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i;
export const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

export const CURRENCY_CANADA = 'cad';
export const CURRENCY_US = 'usd';

// ----- general helpers -----
export function getQueryParam(param, defaultValue = null) {
const urlParams = new URLSearchParams(window.location.search);
Expand Down
Loading