/
Goals from key words
Goals from key words
Does your website still use the keywords meta tag?
<meta name="keywords" content="Widgets,Widget Services" />
If this contains page-specific words and phrases, it could be quick source of Goal data for identifying visitor areas of interest.
// Listen for load event, or run whenever you want to add current page keywords.
window.addEventListener('load', () => {
// Get the <meta> tag from the header, if it exists.
let kwElem = document.head.querySelector('meta[name="keywords"]');
if (kwElem) {
// Split by comma and add a Goal for each.
kwElem.content.split(',').map(kw => kw.trim()).filter(kw => kw).forEach(kw => {
// Add 1 for each time the keyword is encountered.
// You could add a prefix, e.g. 'KEYWORD_', to distinguish from other Goals.
window.send2crm?.analytics?.setGoal(kw.replaceAll(' ', '_'), 1);
});
}
});