From b9135be54cc7d11391d397adffcad230ec36825c Mon Sep 17 00:00:00 2001 From: Jacob Bare Date: Fri, 5 Mar 2021 13:14:01 -0600 Subject: [PATCH] Create inquiry submission tracker Pushes the inquiry payload to P1 events --- packages/marko-web-p1-events/browser/index.js | 5 +++ .../browser/track-inquiry-submission.vue | 36 +++++++++++++++++++ .../marko-web-p1-events/components/marko.json | 14 ++++++++ .../components/track-inquiry-submission.marko | 12 +++++++ 4 files changed, 67 insertions(+) create mode 100644 packages/marko-web-p1-events/browser/track-inquiry-submission.vue create mode 100644 packages/marko-web-p1-events/components/track-inquiry-submission.marko diff --git a/packages/marko-web-p1-events/browser/index.js b/packages/marko-web-p1-events/browser/index.js index a01be7255..fc33765a8 100644 --- a/packages/marko-web-p1-events/browser/index.js +++ b/packages/marko-web-p1-events/browser/index.js @@ -1,5 +1,10 @@ const TrackContentBodyLinks = () => import(/* webpackChunkName: "p1-events-track-content-body-links" */ './track-content-body-links.vue'); +const TrackInquirySubmission = () => import(/* webpackChunkName: "p1-events-track-inquiry-submission" */ './track-inquiry-submission.vue'); export default (Browser) => { + const { EventBus } = Browser; Browser.register('P1EventsTrackContentBodyLinks', TrackContentBodyLinks); + Browser.register('P1EventsTrackInquirySubmission', TrackInquirySubmission, { + provide: { EventBus }, + }); }; diff --git a/packages/marko-web-p1-events/browser/track-inquiry-submission.vue b/packages/marko-web-p1-events/browser/track-inquiry-submission.vue new file mode 100644 index 000000000..64c00889d --- /dev/null +++ b/packages/marko-web-p1-events/browser/track-inquiry-submission.vue @@ -0,0 +1,36 @@ + + + diff --git a/packages/marko-web-p1-events/components/marko.json b/packages/marko-web-p1-events/components/marko.json index 05a631b31..7f3599a34 100644 --- a/packages/marko-web-p1-events/components/marko.json +++ b/packages/marko-web-p1-events/components/marko.json @@ -26,6 +26,20 @@ "@action": "string", "@category": "string" }, + "": { + "template": "./track-inquiry-submission.marko", + "": { + "@id": { + "type": "number", + "required": true + }, + "@type": { + "type": "string", + "required": true + } + }, + "@event-name": "string" + }, "": { "template": "./track-website-section.marko", "@node": "object" diff --git a/packages/marko-web-p1-events/components/track-inquiry-submission.marko b/packages/marko-web-p1-events/components/track-inquiry-submission.marko new file mode 100644 index 000000000..317e28e59 --- /dev/null +++ b/packages/marko-web-p1-events/components/track-inquiry-submission.marko @@ -0,0 +1,12 @@ +import { getAsObject } from "@parameter1/base-cms-object-path"; +import eventEntity from "../utils/base-content-entity"; + +$ const content = getAsObject(input, "content"); + +