Marketing
Marketing
Index.js
- Acts as a factory to create a new marketing object which registers each method available, passing in the context
- If method set equal to null if not available
- Set the context.marketing equal to this object for frontend use
Methods
Newsletter
Used to manage user registrations to email lists in HQ (subscribe and unsubscribe)
index.js
- Registers api, repository, and service files
- Set the context equal to the service, routing all method calls to the Service file
service.js
- Initialize respository object passed in from
index.js subscribe()- Accept
email,first_name, andlast_namefrom frontend, defaulting names to null if not available - Call repository to subscribe the user email
- Accept
unsubscribe()- Accept
emailand call repository to unsubscribe the user email
- Accept
repository.js
- Initialize store and api objects passed in from
index.js subscribe()- Accept
email,first_name, andlast_name, defaulting names to null if not available - Retrieve the cart UUID if it exists
- If available, set the user email in the cart equal to the subscriber email passed in. This makes the checkout process more fluid for the user
- Call api to subscribe the user email
- Accept
unsubscribe()- Accept
emailand call api to unsubscribe the user email
- Accept
api.js
- Initialize axios object passed in from
index.js subscribe()- Accept
email,first_name,last_name, andcart_uuid, defaulting names and cart uuid to null if not available - Post a request to HQ to subscribe the user email
- HQ will register the email for the site within our database, and it will route the email subscribtion call to Drip
- Accept
unsubscribe()- Accept
emailand post a request to HQ to unsubscribe the user email from our email list
- Accept
Reviews
::: warning Note Reviews are currently being handled by Yotpo. Future use of the reviews feature may be used to move away from this 3rd party service, but until that time please refer to the Yotpo documentation :::
SMS
Used to manage user registrations to sms text and email lists in HQ (subscribe and unsubscribe)
index.js
- Registers api and service files
- Set the context equal to the service, routing all method calls to the Service file
service.js
- Initialize
apiobject passed in fromindex.js subscribe()- Accept
phoneNumber,email,first_name,last_name, andsignUpSourceIdfrom frontend, defaulting values to null if not available- SignUpSourceId is used to subscribe a user through Attentive
- Call api to subscribe the user’s phone number and email (when available)
- Accept
unsubscribe()- Accept
phoneNumberand call api to unsubscribe the user’s phone number
- Accept
api.js
- Initialize
axiosobject passed in fromindex.js subscribe()- Accept
phoneNumber,email,first_name,last_name, andsignUpSourceId, defaulting values to null if not available - Post a request to HQ to subscribe the user phone number and email (when available)
- HQ will register the phone and email for the site within our database, and it will route the subscribtion call to both Drip and Attentive
- Accept
unsubscribe()- Accept
emailand post a request to HQ to unsubscribe the user phone number from our sms list
- Accept
Yotpo
Used to track and display reviews, display USG content with linked products, and monitor user interactions with the site (such as tracking when an order has been placed). Scripts are loaded and placed in designated blocks on pages, and CSS customizations can be made in the Yotpo online interface (e.g., View Becki Owens Living CSS).
index.js
- If no reviews configuration is available within the site context, break and do not attempt to load Yotpo scripts
- Registers api, repository, and service files
- Return the service, routing all method calls to the Service file
service.js
- Initialize
respositoryobject passed in fromindex.js - Retrieve the appKey from the repository
- If key exists, load Yotpo’s site script
loadScript()- Create script url using the appKey
- Return a promise that loads the body script for frontend use (to display and collect reviews)
loadOrderScript()- Loads two scripts on the order confirmation page
- Track conversion data with
orderId,orderAmount, andorderCurrency - Insert a pixel script that yotpo uses to locate and track the order data ::: warning Note Within HQ there is an event that triggers whenever an order is marked as shipped. This event will gather and format the order data, and send it to Yotpo as a ‘Fulfilled Order’. This is useful in sending users updates on order shipment notifications, should that be used in the future within Yotpo. :::
- Track conversion data with
- Loads two scripts on the order confirmation page
trackEvent()- Call repository to track event
- If successfully tracked, get order details from checkout, and load the yotpo order script
repository.js
- Initialize
store,siteRepository,reviewsConfig, andapiobjects passed in fromindex.js getAppKey()- Returns appKey from the reviewsConfig passed in from the frontend
trackEvent()- Retrieve the customer ID within the site region
- Add this customer ID to the eventData being passed in
- Call API to track the event
api.js
- Initialize
axiosobject passed in fromindex.js trackEvent()- Post a request to HQ to track the event
- Return the promise of event (resolved or rejected)