Skip to content

Instantly share code, notes, and snippets.

@nitinhayaran
Created February 3, 2021 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nitinhayaran/51e5c2d333fa6d63e8ef19cb3e501d79 to your computer and use it in GitHub Desktop.
Save nitinhayaran/51e5c2d333fa6d63e8ef19cb3e501d79 to your computer and use it in GitHub Desktop.
smartLookEvent.js
import smartlookClient from 'smartlook-client'
const SmartLookEvent = {
initialize: () => {
const isBotUserAgent = () => {
return (
navigator &&
navigator.userAgent &&
/bot|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|prerender/i.test(
navigator.userAgent
)
);
};
try {
console.log('going to initialize smartlook');
if (!isBotUserAgent() && process.env.REACT_APP_smartlookProjectKey) {
console.log('SmartLook initialized');
smartlookClient.init(process.env.REACT_APP_smartlookProjectKey);
}
} catch (e) {
console.log('smartlook error', e.message);
}
},
};
export default SmartLookEvent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment