SlideShare a Scribd company logo
1 of 29
#MM18PL#MM18PL
Integrating voice search in
Magento 2 using Web
Speech API
Adrian Bece | @AdrianBDesigns
#MM18PL#MM18PL
Adrian Bece
● Working at Inchoo since 2015
● React Developer
● Certified Magento 1 Frontend Developer
● Worked on various Magento 1 and Magento 2 projects for international clients
● Worked on numerous personal React projects
@AdrianBDesigns | codeadrian.github.io
#MM18PL#MM18PL
“Voice commerce represents the next major disruption in
the retail industry (…) The speed with which consumers
are adopting smart speakers will translate into a number
of opportunities and even more challenges for traditional
retailers and consumer products companies.”
- John Franklin, OC&C (December 2017)
#MM18PL#MM18PL
Voice Shopping & Home assistants
● People are getting more accustomed to Voice Shopping (Smart Speaker / Home
Assistants)
● Amazon dominates the Home assistant market with Echo device (68%)
● In late 2017, Walmart has teamed with Google to offer Voice Shopping
● Most commonly shopped categories through voice:
Groceries (20%), Entertainment (19%), Electronics (17%), Clothing (8%) *
● Voice purchases tend to be stand-alone, lower value items *
● Prediction: Voice Shopping Market in US to grow from $2 billion to $40 billion in 2022 *
* OC&C Strategy Consultants Study (December 2017)
#MM18PL#MM18PL
Voice Shopping & Home assistants - concerns
● Not convenient for obtaining information about product (attributes, description, price, etc.)
● Product keywords might change → voice search results might change
● 2% of the people who use Amazon’s Echo have made a purchase with their voices in 2018 *
● Of the people who used voice shopping, most people didn’t use Voice shopping again *
● People who did use Voice Shopping again, used it more extensively (searching, tracking
orders, etc.) *
● Amazon tries to encourage Voice Shopping by offering discounts and better deals
● There is potential in Voice Shopping, but there is no established pattern which is familiar to
users
* Anonymous Sources (Amazon insider info) for “The Information” (August 2018)
#MM18PL#MM18PL
What about regular
Web browsers?
#MM18PL#MM18PL
Browser Voice Search Potential
● Google Voice Search queries has grown 7x since 2010
● Android - 1 of 5 searches are done by voice (US)
● Baidu - 1 of 10 searches are done by voice
● 1 of 3 users use voice recognition technology on their device daily
● Number of voice searches expected to continue growing
● Prediction: 50% of searches will be done by voice by 2020.
#MM18PL#MM18PL
Web Speech API
● Provides speech-input and text-to-speech functionality in a web browser
● Web apps are able to handle voice data
● Interesting new possibilities for accessibility and control mechanisms
● Features which are not typically available when using standard software
● Experimental technology
● Two main parts
● Speech Recognition API
● provides ability to recognize voice from an audio input
● Speech Synthesis API
● provides ability to read out the text content
#MM18PL#MM18PL
Speech Recognition API (63% global browser support)
#MM18PL#MM18PL
Speech Synthesis API (80% global browser support)
#MM18PL#MM18PL
Speech Recognition API
● It requires internet connection to work on Chrome
● HTTPS only - can be avoided if specific flag is set when running Chrome
● It requires a config flag to be set in Firefox
● Properties
● Grammar, Language, Single / Multiple Results, Final / Interim Results
● Events
● Audio start, Audio end, On error, On result, On speech start, On speech end, etc.
● Methods
● Starting speech recognition, Stopping with returning a result, Stopping without returning a
result
#MM18PL#MM18PL
Speech
Recognition Data
• Settings
• Interim Results
• Single Result
• Returns
• Confidence
• Transcript
#MM18PL#MM18PL
Voice recognition can be used for dictating text in a form field,
as well as navigating to and activating links, buttons, and other
controls. (…) Some voice recognition tools allow complete
control over computer interaction, allowing users to scroll the
screen, copy and paste text, activate menus, and perform other
functions.
- W3C Web Accessibility Initiative on “Voice Recognition”
#MM18PL#MM18PL
Accessibility
● Who benefits from the Speech Recognition functionality?
● People with physical disabilities who cannot use the keyboard or mouse.
● People with chronic conditions who need to limit or avoid using the keyboard or
mouse.
● People with cognitive and learning disabilities who need to use voice rather than to
type.
● People with temporary limitations, such as a broken arm.
● People who prefer to speak rather than type (Depends on the device type,
situation, personal preference, etc.)
#MM18PL#MM18PL
web/js/
voiceSearch.js
• General Structure
• Options
• Setup
• Functions
• Event Listeners
• Support Functions
define([
'jquery',
'mage/translate',
'domReady!'
], function ($) {
'use strict';
$.fn.voiceSearch = function (options) {
/***********
* OPTIONS *
***********/
/*********
* SETUP *
*********/
/*************
* FUNCTIONS *
*************/
};
return function (config, node) {
$(node).voiceSearch(config);
}
});
#MM18PL#MM18PL
web/js/
voiceSearch.js
• Options Section
var defaults = {
"placeholderText": "Listening...",
"speechRecognitionTrigger": "#voice-search-
trigger",
"formInput": "#search"
},
$formElement = $(this);
options = $.extend(defaults, options);
$formElement = $(this);
var recognition = null;
var isActive = false;
var speechRecognitionTrigger =
$(options.speechRecognitionTrigger),
$formInput = $(options.formInput),
placeholderText =
$.mage.__(options.placeholderText);
window.SpeechRecognition = window.SpeechRecognition
|| window.webkitSpeechRecognition;
#MM18PL#MM18PL
web/js/
voiceSearch.js
• Setup Section
if (window.SpeechRecognition) {
recognition = new
SpeechRecognition();
recognition.interimResults = true;
this.setupRecognitionListeners();
this.setupVoiceSearchButton();
recognition.onresult =
this.handleOnResult.bind(this);
} else {
speechRecognitionTrigger.hide();
}
#MM18PL#MM18PL
web/js/
voiceSearch.js
• Functions Section
• Event Listeners
this.setupVoiceSearchButton = function () {
speechRecognitionTrigger.on('click touch',
this.startListening);
};
this.setupRecognitionListeners = function () {
recognition.onstart = function () {
isActive = true;
};
recognition.onend = function () {
isActive = false;
};
recognition.onerror = function () {
isActive = false;
};
};
#MM18PL#MM18PL
web/js/
voiceSearch.js
• Functions Section
• Support Functions
this.parseTranscript = function (e) {
return Array.from(e.results).map(
function (result) {
return result[0]
}).map(
function (result) {
return result.transcript
}).join('');
};
this.startListening = function (e) {
e.preventDefault();
if(!isActive) {
$formInput.val('');
$formInput.attr("placeholder", placeholderText);
recognition.start();
}
};
this.handleOnResult = function (e) {
$formInput.val(this.parseTranscript(e).toLowerCase());
if (e.results[0].isFinal) {
$formElement.submit();
}
};
#MM18PL#MM18PL
requirejs-config.js
• Standard mapping
var config = {
map: {
'*': {
'voiceSearch': 'js/voiceSearch'
}
}
};
#MM18PL#MM18PL
Magento_Search/templat
es/form.mini.phtml
• Add a call to the <form> element
• Add voice search <button>
• Add some id-s if necessary
• Call the voiceSearch
• Default parameters
• Custom parameters
(…)
<form
class="form minisearch"
id="search_mini_form"
action="<?= /* @escapeNotVerified */
$helper->getResultUrl() ?>"
method="get"
data-mage-init=‘{"voiceSearch":{}}'>
(…)
<button class="action search voice"
id=“voice-search-trigger"></button>
(…)
(…)
#MM18PL#MM18PL
#MM18PL#MM18PL
Result -
Page Load
• If Web Speech API is not supported, Voice search
button will be hidden
• User will be prompted to confirm microphone
permission
• After user grands permission, the text input
placeholder will change to “Listening…”
#MM18PL#MM18PL
Result - Search
Action
• After user has finished speaking, text will be added
to the search input form
• Form submits and user is redirected to Magento 2
search results page
• User can click again on the Voice Search button
and perform search from the beginning
#MM18PL#MM18PL
Areas Of Improvement
● Confirm the input before submitting the form
● Cancel voice search if input is not received in some time limit
● Check if the confidence of the result is above certain percentage before submitting.
If percentage is lower than the threshold, ask user to repeat the voice search.
● UX improvement - Better communication of current state (recording, submitting
form, etc.)
● Open the product page for the first search result instead of search result page
● Use Google Cloud Speech-to-Text (paid) to enable language recognition and allow
users to search in their native language.
#MM18PL#MM18PL
Additional Ideas
● Voice-controlled shopping
● Search, selecting products
● Selecting quantity, configuring, adding to cart
● Navigating to cart and checkout
● Voice-controlled On-screen assistant
● Speech Synthesis API
● Improved accessibility, voice-controlled shortcuts
● Voice-controlled shopping, contact forms, chat support, shortcuts, etc.
#MM18PL#MM18PL
There might be very few voice shoppers right
now… but once you find out what’s special
about them, you can grow them very quickly.
That’s an unresolved problem.
- The Information, “The Reality Behind Voice Shopping Hype”
(August 2018)
#MM18PL#MM18PL
Conclusion
● People are still getting accustomed to Voice Shopping (home assistants and smart speakers)
● Voice search continues to grow across various desktop and mobile devices
● Web Speech API opens the door for speech recognition from a Web Browser (it’s still
experimental)
● Beneficial for accessibility, also has potential for regular use
● Consider adding the functionality in stages and monitor how customers are using it
● Are they using it for product discovery or shop for familiar items?
● Are they using it more on mobile because it’s easier?
● Which voice-controlled functionalities are they using more and which they are using
less?
#MM18PL#MM18PL
Thank you for your
attention.
Adrian Bece | @AdrianBDesigns

More Related Content

Similar to Integrating Voice Search in Magento 2 Using Web Speech API - Adrian Bece

A Tale of Two Case Studies: Using LLMs in Production
A Tale of Two Case Studies: Using LLMs in ProductionA Tale of Two Case Studies: Using LLMs in Production
A Tale of Two Case Studies: Using LLMs in ProductionAggregage
 
Giving Marketing a Voice: 10 Steps for Marketing with Voice Assistants
Giving Marketing a Voice: 10 Steps for Marketing with Voice AssistantsGiving Marketing a Voice: 10 Steps for Marketing with Voice Assistants
Giving Marketing a Voice: 10 Steps for Marketing with Voice AssistantsSurefire Local
 
Sajit Joseph - The road to AI for the enterprise
Sajit Joseph - The road to AI for the enterpriseSajit Joseph - The road to AI for the enterprise
Sajit Joseph - The road to AI for the enterpriseHilary Ip
 
Giving Marketing A Voice Shashi Bellamkonda Digital Summit 2017
Giving Marketing A Voice  Shashi Bellamkonda Digital Summit 2017Giving Marketing A Voice  Shashi Bellamkonda Digital Summit 2017
Giving Marketing A Voice Shashi Bellamkonda Digital Summit 2017Shashi Bellamkonda
 
Shashi Bellamkonda - Giving Marketing a Voice - 10 Steps to Marketing Using V...
Shashi Bellamkonda - Giving Marketing a Voice - 10 Steps to Marketing Using V...Shashi Bellamkonda - Giving Marketing a Voice - 10 Steps to Marketing Using V...
Shashi Bellamkonda - Giving Marketing a Voice - 10 Steps to Marketing Using V...Autumn Quarantotto
 
Google Analytics location data visualised with CARTO & BigQuery
Google Analytics location data visualised with CARTO & BigQueryGoogle Analytics location data visualised with CARTO & BigQuery
Google Analytics location data visualised with CARTO & BigQueryCARTO
 
3 Business Problems Chatbots Solve Best
3 Business Problems Chatbots Solve Best3 Business Problems Chatbots Solve Best
3 Business Problems Chatbots Solve BestHaptik
 
Natural born conversion killers - Conversion Jam
Natural born conversion killers - Conversion JamNatural born conversion killers - Conversion Jam
Natural born conversion killers - Conversion JamCraig Sullivan
 
Mobile presentation - Sydney Online Retailer - 26 Sep 2011
Mobile presentation - Sydney Online Retailer - 26 Sep 2011Mobile presentation - Sydney Online Retailer - 26 Sep 2011
Mobile presentation - Sydney Online Retailer - 26 Sep 2011Craig Sullivan
 
Mobile product - "Build great apps!" at ProductTank Paris #17
Mobile product - "Build great apps!" at ProductTank Paris #17Mobile product - "Build great apps!" at ProductTank Paris #17
Mobile product - "Build great apps!" at ProductTank Paris #17Alexandre Jubien
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language ProcessingAkhilPolisetty
 
Breaking Language Barriers: Machine Translation for eCommerce
Breaking Language Barriers: Machine Translation for eCommerceBreaking Language Barriers: Machine Translation for eCommerce
Breaking Language Barriers: Machine Translation for eCommercekantanmt
 
Measure camp tools of the cro rabble
Measure camp   tools of the cro rabbleMeasure camp   tools of the cro rabble
Measure camp tools of the cro rabbleCraig Sullivan
 
Voice search optimization you should know | Strategies of voice engine optimi...
Voice search optimization you should know | Strategies of voice engine optimi...Voice search optimization you should know | Strategies of voice engine optimi...
Voice search optimization you should know | Strategies of voice engine optimi...Cbitss Technologies
 
Slash n 2018 - Just In Time Personalization
Slash n  2018 - Just In Time Personalization Slash n  2018 - Just In Time Personalization
Slash n 2018 - Just In Time Personalization FlipkartStories
 
SEO - What is it?
SEO - What is it?SEO - What is it?
SEO - What is it?Woj Kwasi
 
The future of mobile marketing and the benefits of web apps @ Riga Comm 2013
The future of mobile marketing and the benefits of web apps @ Riga Comm 2013The future of mobile marketing and the benefits of web apps @ Riga Comm 2013
The future of mobile marketing and the benefits of web apps @ Riga Comm 2013webapptool
 
Voice Technology Search Strategies
Voice Technology Search Strategies Voice Technology Search Strategies
Voice Technology Search Strategies Melissa Walner
 

Similar to Integrating Voice Search in Magento 2 Using Web Speech API - Adrian Bece (20)

A Tale of Two Case Studies: Using LLMs in Production
A Tale of Two Case Studies: Using LLMs in ProductionA Tale of Two Case Studies: Using LLMs in Production
A Tale of Two Case Studies: Using LLMs in Production
 
Giving Marketing a Voice: 10 Steps for Marketing with Voice Assistants
Giving Marketing a Voice: 10 Steps for Marketing with Voice AssistantsGiving Marketing a Voice: 10 Steps for Marketing with Voice Assistants
Giving Marketing a Voice: 10 Steps for Marketing with Voice Assistants
 
Sajit Joseph - The road to AI for the enterprise
Sajit Joseph - The road to AI for the enterpriseSajit Joseph - The road to AI for the enterprise
Sajit Joseph - The road to AI for the enterprise
 
Giving Marketing A Voice Shashi Bellamkonda Digital Summit 2017
Giving Marketing A Voice  Shashi Bellamkonda Digital Summit 2017Giving Marketing A Voice  Shashi Bellamkonda Digital Summit 2017
Giving Marketing A Voice Shashi Bellamkonda Digital Summit 2017
 
Shashi Bellamkonda - Giving Marketing a Voice - 10 Steps to Marketing Using V...
Shashi Bellamkonda - Giving Marketing a Voice - 10 Steps to Marketing Using V...Shashi Bellamkonda - Giving Marketing a Voice - 10 Steps to Marketing Using V...
Shashi Bellamkonda - Giving Marketing a Voice - 10 Steps to Marketing Using V...
 
Google Analytics location data visualised with CARTO & BigQuery
Google Analytics location data visualised with CARTO & BigQueryGoogle Analytics location data visualised with CARTO & BigQuery
Google Analytics location data visualised with CARTO & BigQuery
 
3 Business Problems Chatbots Solve Best
3 Business Problems Chatbots Solve Best3 Business Problems Chatbots Solve Best
3 Business Problems Chatbots Solve Best
 
Natural born conversion killers - Conversion Jam
Natural born conversion killers - Conversion JamNatural born conversion killers - Conversion Jam
Natural born conversion killers - Conversion Jam
 
Mobile presentation - Sydney Online Retailer - 26 Sep 2011
Mobile presentation - Sydney Online Retailer - 26 Sep 2011Mobile presentation - Sydney Online Retailer - 26 Sep 2011
Mobile presentation - Sydney Online Retailer - 26 Sep 2011
 
Data & AI Master Class - Jan Klawer, Artefact
Data & AI Master Class - Jan Klawer, ArtefactData & AI Master Class - Jan Klawer, Artefact
Data & AI Master Class - Jan Klawer, Artefact
 
Mobile product - "Build great apps!" at ProductTank Paris #17
Mobile product - "Build great apps!" at ProductTank Paris #17Mobile product - "Build great apps!" at ProductTank Paris #17
Mobile product - "Build great apps!" at ProductTank Paris #17
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Breaking Language Barriers: Machine Translation for eCommerce
Breaking Language Barriers: Machine Translation for eCommerceBreaking Language Barriers: Machine Translation for eCommerce
Breaking Language Barriers: Machine Translation for eCommerce
 
Measure camp tools of the cro rabble
Measure camp   tools of the cro rabbleMeasure camp   tools of the cro rabble
Measure camp tools of the cro rabble
 
Voice search optimization you should know | Strategies of voice engine optimi...
Voice search optimization you should know | Strategies of voice engine optimi...Voice search optimization you should know | Strategies of voice engine optimi...
Voice search optimization you should know | Strategies of voice engine optimi...
 
Slash n 2018 - Just In Time Personalization
Slash n  2018 - Just In Time Personalization Slash n  2018 - Just In Time Personalization
Slash n 2018 - Just In Time Personalization
 
Everwrite pitch deck
Everwrite pitch deckEverwrite pitch deck
Everwrite pitch deck
 
SEO - What is it?
SEO - What is it?SEO - What is it?
SEO - What is it?
 
The future of mobile marketing and the benefits of web apps @ Riga Comm 2013
The future of mobile marketing and the benefits of web apps @ Riga Comm 2013The future of mobile marketing and the benefits of web apps @ Riga Comm 2013
The future of mobile marketing and the benefits of web apps @ Riga Comm 2013
 
Voice Technology Search Strategies
Voice Technology Search Strategies Voice Technology Search Strategies
Voice Technology Search Strategies
 

Recently uploaded

“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdfMuhammad Subhan
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTopCSSGallery
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxMasterG
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityVictorSzoltysek
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...panagenda
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Skynet Technologies
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxFIDO Alliance
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهMohamed Sweelam
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftshyamraj55
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistandanishmna97
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxjbellis
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch TuesdayIvanti
 

Recently uploaded (20)

“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistan
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 

Integrating Voice Search in Magento 2 Using Web Speech API - Adrian Bece

  • 1. #MM18PL#MM18PL Integrating voice search in Magento 2 using Web Speech API Adrian Bece | @AdrianBDesigns
  • 2. #MM18PL#MM18PL Adrian Bece ● Working at Inchoo since 2015 ● React Developer ● Certified Magento 1 Frontend Developer ● Worked on various Magento 1 and Magento 2 projects for international clients ● Worked on numerous personal React projects @AdrianBDesigns | codeadrian.github.io
  • 3. #MM18PL#MM18PL “Voice commerce represents the next major disruption in the retail industry (…) The speed with which consumers are adopting smart speakers will translate into a number of opportunities and even more challenges for traditional retailers and consumer products companies.” - John Franklin, OC&C (December 2017)
  • 4. #MM18PL#MM18PL Voice Shopping & Home assistants ● People are getting more accustomed to Voice Shopping (Smart Speaker / Home Assistants) ● Amazon dominates the Home assistant market with Echo device (68%) ● In late 2017, Walmart has teamed with Google to offer Voice Shopping ● Most commonly shopped categories through voice: Groceries (20%), Entertainment (19%), Electronics (17%), Clothing (8%) * ● Voice purchases tend to be stand-alone, lower value items * ● Prediction: Voice Shopping Market in US to grow from $2 billion to $40 billion in 2022 * * OC&C Strategy Consultants Study (December 2017)
  • 5. #MM18PL#MM18PL Voice Shopping & Home assistants - concerns ● Not convenient for obtaining information about product (attributes, description, price, etc.) ● Product keywords might change → voice search results might change ● 2% of the people who use Amazon’s Echo have made a purchase with their voices in 2018 * ● Of the people who used voice shopping, most people didn’t use Voice shopping again * ● People who did use Voice Shopping again, used it more extensively (searching, tracking orders, etc.) * ● Amazon tries to encourage Voice Shopping by offering discounts and better deals ● There is potential in Voice Shopping, but there is no established pattern which is familiar to users * Anonymous Sources (Amazon insider info) for “The Information” (August 2018)
  • 7. #MM18PL#MM18PL Browser Voice Search Potential ● Google Voice Search queries has grown 7x since 2010 ● Android - 1 of 5 searches are done by voice (US) ● Baidu - 1 of 10 searches are done by voice ● 1 of 3 users use voice recognition technology on their device daily ● Number of voice searches expected to continue growing ● Prediction: 50% of searches will be done by voice by 2020.
  • 8. #MM18PL#MM18PL Web Speech API ● Provides speech-input and text-to-speech functionality in a web browser ● Web apps are able to handle voice data ● Interesting new possibilities for accessibility and control mechanisms ● Features which are not typically available when using standard software ● Experimental technology ● Two main parts ● Speech Recognition API ● provides ability to recognize voice from an audio input ● Speech Synthesis API ● provides ability to read out the text content
  • 9. #MM18PL#MM18PL Speech Recognition API (63% global browser support)
  • 10. #MM18PL#MM18PL Speech Synthesis API (80% global browser support)
  • 11. #MM18PL#MM18PL Speech Recognition API ● It requires internet connection to work on Chrome ● HTTPS only - can be avoided if specific flag is set when running Chrome ● It requires a config flag to be set in Firefox ● Properties ● Grammar, Language, Single / Multiple Results, Final / Interim Results ● Events ● Audio start, Audio end, On error, On result, On speech start, On speech end, etc. ● Methods ● Starting speech recognition, Stopping with returning a result, Stopping without returning a result
  • 12. #MM18PL#MM18PL Speech Recognition Data • Settings • Interim Results • Single Result • Returns • Confidence • Transcript
  • 13. #MM18PL#MM18PL Voice recognition can be used for dictating text in a form field, as well as navigating to and activating links, buttons, and other controls. (…) Some voice recognition tools allow complete control over computer interaction, allowing users to scroll the screen, copy and paste text, activate menus, and perform other functions. - W3C Web Accessibility Initiative on “Voice Recognition”
  • 14. #MM18PL#MM18PL Accessibility ● Who benefits from the Speech Recognition functionality? ● People with physical disabilities who cannot use the keyboard or mouse. ● People with chronic conditions who need to limit or avoid using the keyboard or mouse. ● People with cognitive and learning disabilities who need to use voice rather than to type. ● People with temporary limitations, such as a broken arm. ● People who prefer to speak rather than type (Depends on the device type, situation, personal preference, etc.)
  • 15. #MM18PL#MM18PL web/js/ voiceSearch.js • General Structure • Options • Setup • Functions • Event Listeners • Support Functions define([ 'jquery', 'mage/translate', 'domReady!' ], function ($) { 'use strict'; $.fn.voiceSearch = function (options) { /*********** * OPTIONS * ***********/ /********* * SETUP * *********/ /************* * FUNCTIONS * *************/ }; return function (config, node) { $(node).voiceSearch(config); } });
  • 16. #MM18PL#MM18PL web/js/ voiceSearch.js • Options Section var defaults = { "placeholderText": "Listening...", "speechRecognitionTrigger": "#voice-search- trigger", "formInput": "#search" }, $formElement = $(this); options = $.extend(defaults, options); $formElement = $(this); var recognition = null; var isActive = false; var speechRecognitionTrigger = $(options.speechRecognitionTrigger), $formInput = $(options.formInput), placeholderText = $.mage.__(options.placeholderText); window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
  • 17. #MM18PL#MM18PL web/js/ voiceSearch.js • Setup Section if (window.SpeechRecognition) { recognition = new SpeechRecognition(); recognition.interimResults = true; this.setupRecognitionListeners(); this.setupVoiceSearchButton(); recognition.onresult = this.handleOnResult.bind(this); } else { speechRecognitionTrigger.hide(); }
  • 18. #MM18PL#MM18PL web/js/ voiceSearch.js • Functions Section • Event Listeners this.setupVoiceSearchButton = function () { speechRecognitionTrigger.on('click touch', this.startListening); }; this.setupRecognitionListeners = function () { recognition.onstart = function () { isActive = true; }; recognition.onend = function () { isActive = false; }; recognition.onerror = function () { isActive = false; }; };
  • 19. #MM18PL#MM18PL web/js/ voiceSearch.js • Functions Section • Support Functions this.parseTranscript = function (e) { return Array.from(e.results).map( function (result) { return result[0] }).map( function (result) { return result.transcript }).join(''); }; this.startListening = function (e) { e.preventDefault(); if(!isActive) { $formInput.val(''); $formInput.attr("placeholder", placeholderText); recognition.start(); } }; this.handleOnResult = function (e) { $formInput.val(this.parseTranscript(e).toLowerCase()); if (e.results[0].isFinal) { $formElement.submit(); } };
  • 20. #MM18PL#MM18PL requirejs-config.js • Standard mapping var config = { map: { '*': { 'voiceSearch': 'js/voiceSearch' } } };
  • 21. #MM18PL#MM18PL Magento_Search/templat es/form.mini.phtml • Add a call to the <form> element • Add voice search <button> • Add some id-s if necessary • Call the voiceSearch • Default parameters • Custom parameters (…) <form class="form minisearch" id="search_mini_form" action="<?= /* @escapeNotVerified */ $helper->getResultUrl() ?>" method="get" data-mage-init=‘{"voiceSearch":{}}'> (…) <button class="action search voice" id=“voice-search-trigger"></button> (…) (…)
  • 23. #MM18PL#MM18PL Result - Page Load • If Web Speech API is not supported, Voice search button will be hidden • User will be prompted to confirm microphone permission • After user grands permission, the text input placeholder will change to “Listening…”
  • 24. #MM18PL#MM18PL Result - Search Action • After user has finished speaking, text will be added to the search input form • Form submits and user is redirected to Magento 2 search results page • User can click again on the Voice Search button and perform search from the beginning
  • 25. #MM18PL#MM18PL Areas Of Improvement ● Confirm the input before submitting the form ● Cancel voice search if input is not received in some time limit ● Check if the confidence of the result is above certain percentage before submitting. If percentage is lower than the threshold, ask user to repeat the voice search. ● UX improvement - Better communication of current state (recording, submitting form, etc.) ● Open the product page for the first search result instead of search result page ● Use Google Cloud Speech-to-Text (paid) to enable language recognition and allow users to search in their native language.
  • 26. #MM18PL#MM18PL Additional Ideas ● Voice-controlled shopping ● Search, selecting products ● Selecting quantity, configuring, adding to cart ● Navigating to cart and checkout ● Voice-controlled On-screen assistant ● Speech Synthesis API ● Improved accessibility, voice-controlled shortcuts ● Voice-controlled shopping, contact forms, chat support, shortcuts, etc.
  • 27. #MM18PL#MM18PL There might be very few voice shoppers right now… but once you find out what’s special about them, you can grow them very quickly. That’s an unresolved problem. - The Information, “The Reality Behind Voice Shopping Hype” (August 2018)
  • 28. #MM18PL#MM18PL Conclusion ● People are still getting accustomed to Voice Shopping (home assistants and smart speakers) ● Voice search continues to grow across various desktop and mobile devices ● Web Speech API opens the door for speech recognition from a Web Browser (it’s still experimental) ● Beneficial for accessibility, also has potential for regular use ● Consider adding the functionality in stages and monitor how customers are using it ● Are they using it for product discovery or shop for familiar items? ● Are they using it more on mobile because it’s easier? ● Which voice-controlled functionalities are they using more and which they are using less?
  • 29. #MM18PL#MM18PL Thank you for your attention. Adrian Bece | @AdrianBDesigns