# Combo Cart Flow Analytic Scripts

This is the outline of what functions get called where and when in combo cart flows. This documentation only includes the functions we call, the documentation about analytics library is not included here.

# Sponsorship

The sponsorship flow applies only to flows where a child is sponsored. The following pages are the main landing pages:

  • Find a child aka Children list page. User can add a child to cart. https://lo-test.savethechildren.org/site/SPageNavigator/sponsorship.html
  • Read more details about a child aka Child profile page. {child-id} is a variable unique per child https://lo-test.savethechildren.org/site/SPageNavigator/sponsorship.html#!/child/{child-id}

# Sponsorship page

  • View page - setSponsorshipProductId()
  • View children - setChildrenViewedCountAnalytics()
  • Execute a search - trackSponsorshipSearchAnalytics()
  • View child profile - trackChildProfileClick(), setChildProfilesViewedAnalytics(), setChildSearchParametersAnalytics(),
  • Child added to cart (list or profile page) - setChildAddedSponsorshipAnalytics()
  • View error - setApiFailure()

# Cart page

  • View cart:
    • updateBasket() which calls fetchCartDetails(), which grabs all products from the Luminate cart, maps categories and sets the counts into a cookie and product details into the local storage. Calls initialte in combo-cart-app.js
    • setComboCartAnalytics() - sets analytics objects
    • trackInAnalytics() - triggers analytics submission
  • Set gift sponsorship - setProductAnalytics() updates product ids and types
  • Add donation or change donation type - setDonationAndFormAnalytics() updates form & donation details only. Must be both as they live in the same final object, doing for clarity and simplicity, as setFrom analytics method rewrites the data.
  • Form submit - nothing

# Shipping Page

  • View page - setComboCartAnalytics(), trackInAnalytics()
  • Form submit - nothing

# Billing Page

  • View page - setComboCartAnalytics(), trackInAnalytics()
  • How did you hear about us input change - setHowDidYouHearAnalytics()
  • Payment type change - setCurrentPaymentType()
  • Form submit done via submitSponsorshipBilling():
    • Just child in the cart: submitSponsorshipOnlyBilling() -> submitSponsorshipOnlyBillingResponse()
      • On success: setConfirmationIdAnalytics(), trackTransactionSuccessAnalytics(), resetAnalyticsData()
      • On error: setFormSubmissionErrorAnalytics()
    • Child & one time donation in the cart
    • Child & recurring donation in the cart. On success:
      • setConfirmationIdAnalytics(), setConfirmationIdAnalytics(), trackTransactionSuccessAnalytics(),

# Thank you page

  • trackUserAnalytics() - checks if user is logged in and tracks registration in analytics.

# Gift Catalog / Combo cart

# Category page

  • No custom events standard page load picks everything up

# Product page

  • Analytics Data Layer JS - sets product_id as a page param on page load, if one is missing. One could be missing if the user clicked on "Buy Now", which is a form submission & not an image, which is a link.
  • Add product to ca̦rt:
    • registerProductId() sets the category mapping
    • submissionSuccessAnalytics() - standard form submission, but invokes a custom call rules ecommerce_add_cart rather than using standard form_submit

# Cart

  • Same as sponsorship

# Shipping page

  • View page - setComboCartAnalytics(), trackInAnalytics()

# Billing Page

  • View page - setComboCartAnalytics(), trackInAnalytics()
    • Form submit:
      • If nothing but catalog items are present or if a single donation is present: nothing
      • If sponsorship is present:

# Review page

  • View page - setComboCartAnalytics(), trackInAnalytics()
  • If additional recurring donation is present and/or sponsorship is present
    • On success: setConfirmationIdFromAPIAnalytics()

# Thank you page

  • (mainly controlled by combo-cart-order-submit-success component):
    • setConfirmationIdAnalytics() - adds gift catalog confirmation code in store/local storage
    • setComboCartAnalytics() - sets all the other data
    • setCombinedConfirmationCodesAnalytics() - writes combined confirmation codes into digitalData analytics object
    • trackTransactionSuccessAnalytics() - triggers data submission to analytics
    • resetAnalyticsData() - resets analytics data
    • trackUserAnalytics() - tracks user registration combo-cart-commit-receipt