{
  "rules": [
    {
      "name": "TrackPageLoad",
      "payload": {
        "event": "trackPageLoad",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-0001",
          "ucsState": "non-pv",
          "eventName": "pageLoad",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "PL-$[eventSource]"
        },
        "page": {
          "pageName": "$[eventSource]:$[pageName:home]",
          "language": "$[language]",
          "loadTime": "$[loadTime]",
          "breakPoints": "$[breakpoint]",
          "loB": "$[loB]",
          "phoneDisplayed": "$[phoneDisplayed:none]"
        },
        "faq": {
          "faqDisplay": "$[faqDisplay:false]"
        },
        "chat": {
          "chatDisplay": "$[chatDisplay:false]"
        },
        "banner": {
          "bannerDisplay": "$[bannerDisplay:false]"
        },
        "user": {
          "bncId": "$[bncId:undefined]",
          "loggedStatus": "$[loggedStatus:false]"
        }
      }
    },
    {
      "name": "TrackPageReady",
      "selector": "window",
      "events": "load",
      "payload": {
        "event": "trackPageView",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-0002",
          "ucsState": "pv",
          "eventName": "pageReady",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "PR-$[eventSource]"
        },
        "page": {
          "pageName": "$[eventSource]:$[pageName:home]",
          "language": "$[language]",
          "loadTime": "$[loadTime]",
          "breakPoints": "$[breakpoint]",
          "loB": "$[loB]",
          "phoneDisplayed": "$[phoneDisplayed:none]",
          "province": "$[province]"
        },
        "faq": {
          "faqDisplay": "$[faqDisplay:false]"
        },
        "chat": {
          "chatDisplay": "$[chatDisplay:false]"
        },
        "banner": {
          "bannerDisplay": "$[bannerDisplay:false]"
        },
        "user": {
          "bncId": "$[bncId:undefined]",
          "loggedStatus": "$[loggedStatus:false]"
        }
      }
    },
    {
      "name": "TrackSiteSearch",
      "selector": ".searchResult.section",
      "events": "search",
      "delay": 1000,
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-SCS",
          "ucsState": "non-pv",
          "eventName": "searchSite",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "SCS-$[eventSource]"
        },
        "search": {
          "searchTerms": "$[searchTerms]",
          "searchResults": "$[searchResults:0]"
        }
      },
      "variables": {
        "searchTerms": {
          "type": "selector",
          "selector": "this",
          "parent": ".searchResult.section",
          "child": "#search-result-topbar-query-text input[name='q']",
          "method": "val"
        },
        "searchResults": {
          "type": "selector",
          "selector": "this",
          "parent": ".searchResult.section",
          "child": "#search-result-header-number",
          "method": "text",
          "args": {
            "match": "\\d+"
          }
        }
      }
    },
    {
      "name": "TrackOtherCTA_SearchResultClick",
      "selector": "ul#search-result-detail-pages-container li .search-result-detail",
      "delegate": ".searchResult.section",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-CCTA",
          "ucsState": "non-pv",
          "eventName": "clickCTA",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "CCTA-$[eventSource]",
          "interaction": "scs answer : $[resultHref]"
        }
      },
      "variables": {
        "resultHref": {
          "type": "selector",
          "selector": "this",
          "method": "attr",
          "args": {
            "attr": "onclick",
            "match": "(http(s)?:\\/\\/)([\\w-_\\.\\/]+)(\\.html)"
          }
        }
      }
    },
    {
      "name": "TrackFormLaunch_TravelInsurance",
      "selector": "a[href*='travel.nbc-insurance.ca'], a[href*='voyage.assurances-bnc.ca']",
      "delegate": "body",
      "events": "click",
      "payload": {
          "event": "trackEvent",
          "eventInfo": {
              "ucsId": "UCS-$[eventSource]-FL",
              "ucsState": "non-pv",
              "eventName": "formLaunch",
              "eventSource": "$[eventSource]",
              "eventTime": "$[timestamp]",
              "eventId": "FL-TravelInsurance",
              "interaction": "$[ctaText]"
          },
          "product": {
              "productCategory": "Insurance",
              "productName": "Travel Insurance",
              "productPricing": "",
              "promoDetail": ""
          }
      }
  },
    {
      "name": "TrackClickToCall",
      "selector": "a[href^='tel:']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-CC",
          "ucsState": "non-pv",
          "eventName": "clickToCall",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "CC-$[eventSource]",
          "interaction": "$[ctaTel]"
        }
      },
      "variables": {
        "ctaTel": {
          "type": "selector",
          "selector": "this",
          "method": "attr",
          "args": {
            "attr": "href",
            "match": "\\+?[\\d- \\(\\)]+"
          }
        }
      }
    },
    {
      "name": "TrackClickToEmail",
      "selector": "a[href^='mailto:']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-CE",
          "ucsState": "non-pv",
          "eventName": "clickToEmail",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "CE-$[eventSource]",
          "interaction": "$[ctaMailTo]"
        }
      },
      "variables": {
        "ctaMailTo": {
          "type": "selector",
          "selector": "this",
          "method": "attr",
          "args": {
            "attr": "href",
            "match": "((\\.?[\\w-]+)+)@(([\\w-]+\\.?)+)"
          }
        }
      }
    },
    {
      "name": "TrackOtherCTA_OurPartnersList",
      "selector": ".employeeFilters.section",
      "delay": 1000,
      "events": "filter",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-CCTA",
          "ucsState": "non-pv",
          "eventName": "clickCTA",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "CCTA-$[eventSource]",
          "interaction": "$[listFilters]"
        },
        "product": {
          "productCategory": "Not Applicable",
          "productName": "Not Applicable",
          "productPricing": "Not Applicable",
          "promoDetail": "Not Applicable"
        }
      },
      "variables": {
        "listFilters": {
          "type": "selector",
          "selector": "this",
          "parent": ".employeeFilters.section",
          "child": ".employee-filter.bandeau .btn-group button.dropdown-toggle span",
          "method": "text",
          "args": {
            "joinall": true
          }
        }
      }
    },
    {
      "name": "TrackOtherCTA_PartnerView",
      "selector": ".employee-filter-listing-container",
      "delegate": ".employeeFilters.section",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-CCTA",
          "ucsState": "non-pv",
          "eventName": "clickCTA",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "CCTA-$[eventSource]",
          "interaction": "$[advisorName]"
        },
        "product": {
          "productCategory": "Not Applicable",
          "productName": "Not Applicable",
          "productPricing": "Not Applicable",
          "promoDetail": "Not Applicable"
        }
      },
      "variables": {
        "advisorName": {
          "type": "selector",
          "selector": "this",
          "method": "attr",
          "args": {
            "attr": "data-target",
            "match": "[\\w-_]+(?=\\.html)"
          }
        }
      }
    },
    {
      "name": "Track_PDF_Download",
      "selector": "a[href*='.pdf']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-PDF",
          "ucsState": "non-pv",
          "eventName": "clickPDF",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "PDF-$[eventSource]",
          "interaction": "pdf download - $[ctaText]"
        }
      }
    },
    {
      "name": "TrackOtherCTA_VisitNbc",
      "selector": "a[href*='www.bnc.ca'], a[href*='www.nbc.ca']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-CCTA",
          "ucsState": "non-pv",
          "eventName": "clickCTA",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "CCTA-$[eventSource]",
          "interaction": "Link-to-nbc.ca"
        },
        "product": {
          "productCategory": "Not Applicable",
          "productName": "Not Applicable",
          "productPricing": "Not Applicable",
          "promoDetail": "Not Applicable"
        }
      }
    },
    {
      "name": "TrackOtherCTA_VisitClaimsSite",
      "selector": "a[href*='canassistance.com/espace-assures/reclamations/'], a[href*='canassistance.com/en/policy-holder-section/filing-a-claim/']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-CCTA",
          "ucsState": "non-pv",
          "eventName": "clickCTA",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "CCTA-$[eventSource]",
          "interaction": "Link-to-Claims"
        },
        "product": {
          "productCategory": "Not Applicable",
          "productName": "Not Applicable",
          "productPricing": "Not Applicable",
          "promoDetail": "Not Applicable"
        }
      }
    },
    {
      "name": "TrackOtherCTA_GetAQuote",
      "selector": "a[href='https://apps.nbc-insurance.ca/wq/?language=EN&province=QC&f=ch'], a[href='https://apps.assurances-bnc.ca/wq/?language=FR&province=QC&f=ch']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-CCTA",
          "ucsState": "non-pv",
          "eventName": "clickCTA",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "CCTA-$[eventSource]",
          "interaction": "Get A Quote - Car and home"
      }
      }
    },
    {
      "name": "TrackOtherCTA_GetAQuote",
      "selector": "a[href='https://apps.nbc-insurance.ca/wq/?language=EN&province=QC&f=c'], a[href='https://apps.assurances-bnc.ca/wq/?language=FR&province=QC&f=c']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-CCTA",
          "ucsState": "non-pv",
          "eventName": "clickCTA",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "CCTA-$[eventSource]",
          "interaction": "Get A Quote - Car"
      }
      }
    },
    {
      "name": "TrackOtherCTA_GetAQuote",
      "selector": "a[href='https://apps.nbc-insurance.ca/wq/?language=EN&province=QC&f=h'], a[href='https://apps.assurances-bnc.ca/wq/?language=FR&province=QC&f=h']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-CCTA",
          "ucsState": "non-pv",
          "eventName": "clickCTA",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "CCTA-$[eventSource]",
          "interaction": "Get A Quote - Home"
      }
      }
    },
    {
      "name": "TrackOtherCTA_VisitNbcPensionPlans",
      "selector": "a[href*='/entreprises/plus-que-bancaire/ressources-humaines/regimes-retraite-collectifs/'], a[href*='/business/going-further/human-resources/group-retirement-plans/']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-CCTA",
          "ucsState": "non-pv",
          "eventName": "clickCTA",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "CCTA-$[eventSource]",
          "interaction": "Pensionplan - $[pensionPlanUrl]"
        },
        "product": {
          "productCategory": "Not Applicable",
          "productName": "Not Applicable",
          "productPricing": "Not Applicable",
          "promoDetail": "Not Applicable"
        }
      },
      "variables": {
        "pensionPlanUrl": {
          "type": "selector",
          "selector": "this",
          "method": "attr",
          "args": {
            "attr": "href",
            "match": "(\\/[\\w-_]+){2}(?=\\.html)"
          }
        }
      }
    },
    {
      "name": "TrackFormLaunch_AutoInsuranceSignup",
      "selector": "a[href*='apps.assurances-bnc.ca/ubi/form'], a[href*='apps.nbc-insurance.ca/ubi/form']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-FL",
          "ucsState": "non-pv",
          "eventName": "formLaunch",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "FL-$[eventSource]-AutoInsuranceSignup",
          "interaction": "$[ctaText]"
        },
        "product": {
          "productCategory": "Insurance",
          "productName": "AutoInsurance Sign Up",
          "productPricing": "Not Applicable",
          "promoDetail": "Not Applicable"
        }
      }
    },
    {
      "name": "TrackFormLaunch_InsuSoumissionExpress",
      "selector": "a[href*='apps.assurances-bnc.ca/quick-quote/desktop/index.html'], a[href*='apps.nbc-insurance.ca/quick-quote/desktop/index.html']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-FL",
          "ucsState": "non-pv",
          "eventName": "formLaunch",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "FL-$[eventSource]-InsuSoumissionExpress",
          "interaction": "$[ctaText]"
        },
        "product": {
          "productCategory": "Insurance",
          "productName": "InsuSoumissionExpress",
          "productPricing": "Not Applicable",
          "promoDetail": "Not Applicable"
        }
      }
    },
    {
      "name": "TrackFormLaunch_AutoInsuranceQuote",
      "selector": "a[href*='apps.assurances-bnc.ca/appstatic/newQuote.html'], a[href*='apps.nbc-insurance.ca/appstatic/newQuote.html']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-FL",
          "ucsState": "non-pv",
          "eventName": "formLaunch",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "FL-$[eventSource]-AutoInsuranceQuote",
          "interaction": "$[ctaText]"
        },
        "product": {
          "productCategory": "Insurance",
          "productName": "AutoInsuranceQuote",
          "productPricing": "Not Applicable",
          "promoDetail": "Not Applicable"
        }
      }
    },
    {
      "name": "TrackFormLaunch_InfoRequest",
      "selector": "a[href*='/cabn/demande-reference-dda.html'], a[href*='/nbif/advisor-reference.html']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-FL",
          "ucsState": "non-pv",
          "eventName": "formLaunch",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "FL-$[eventSource]-InfoRequest",
          "interaction": "$[ctaText]"
        },
        "product": {
          "productCategory": "Insurance",
          "productName": "InfoRequest",
          "productPricing": "Not Applicable",
          "promoDetail": "Not Applicable"
        }
      }
    },
    {
      "name": "TrackFormLaunch_InsuranceContactRequest",
      "selector": "a[href*='/contact/demande-information.html'], a[href*='/contact-us/information-request.html']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-FL",
          "ucsState": "non-pv",
          "eventName": "formLaunch",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "FL-$[eventSource]-InsuranceContactRequest",
          "interaction": "$[ctaText]"
        },
        "product": {
          "productCategory": "Insurance",
          "productName": "ContactRequest",
          "productPricing": "Not Applicable",
          "promoDetail": "Not Applicable"
        }
      }
    },
    {
      "name": "TrackFormLaunch_HomeQuickApply",
      "selector": "a[href*='apps.assurances-bnc.ca/rqq/'], a[href*='apps.nbc-insurance.ca/rqq/']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-FL",
          "ucsState": "non-pv",
          "eventName": "formLaunch",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "FL-$[eventSource]-HomeQuickApply",
          "interaction": "$[ctaText]"
        },
        "product": {
          "productCategory": "Insurance",
          "productName": "Home Insurance Selector",
          "productPricing": "Not Applicable",
          "promoDetail": "Not Applicable"
        }
      }
    },
    {
      "name": "TrackFormLaunch_LifeQuickApply",
      "selector": "a[href*='appliquer.assurances-bnc.ca/'], a[href*='apply.nbc-insurance.ca/']",
      "delegate": "body",
      "events": "click",
      "payload": {
        "event": "trackEvent",
        "eventInfo": {
          "ucsId": "UCS-$[eventSource]-FL",
          "ucsState": "non-pv",
          "eventName": "formLaunch",
          "eventSource": "$[eventSource]",
          "eventTime": "$[timestamp]",
          "eventId": "FL-$[eventSource]-LifeQuickApply",
          "interaction": "$[ctaText]"
        },
        "product": {
          "productCategory": "Insurance",
          "productName": "Life Insurance Selector",
          "productPricing": "Not Applicable",
          "promoDetail": "Not Applicable"
        }
      }
    }
  ],
  "listeners": [
    {
      "selector": "window",
      "events": "load",
      "trigger": {
        "selector": ".searchResult.section",
        "event": "search"
      }
    },
    {
      "selector": ".btn-group ul.dropdown-menu li a",
      "delegate": ".employeeFilters.section",
      "events": "click",
      "trigger": {
        "selector": "this",
        "parent": ".employeeFilters.section",
        "event": "filter"
      }
    }
  ],
  "variables": {
    "phoneDisplayed": {
      "type": "selector",
      "selector": "a[href^='tel:']:lt(3)",
      "method": "attr",
      "args": {
        "attr": "href",
        "match": "\\+?[\\d- \\(\\)]+",
        "joinall": true
      }
    },
    "province": {
      "type": "selector",
      "selector": "#regionSelection .region-box .selected-value.regionListSelected",
      "method": "text",
      "args": {
        "match": "(\\w)+$"
      }
    },
    "faqDisplay": {
      "type": "selector",
      "selector": "div[data-react-id*='floating'][data-react-id*='menu'] .floating-menu",
      "method": "exist"
    },
    "chatDisplay": {
      "type": "selector",
      "selector": "#bnc-chatbot",
      "method": "exist"
    },
    "loggedStatus": {
      "type": "cookie",
      "cookie": "secure_flag"
    },
    "ctaText": {
      "type": "selector",
      "selector": "this",
      "method": "text"
    }
  }
}