Skip to content

Instantly share code, notes, and snippets.

@otarsko
Created December 4, 2019 15:35
Show Gist options
  • Save otarsko/4f7eeba627e3d6f1e434fc187883cfcc to your computer and use it in GitHub Desktop.
Save otarsko/4f7eeba627e3d6f1e434fc187883cfcc to your computer and use it in GitHub Desktop.
Adobe Experience Cloud without AEM | Triggering Adobe Target SPA view
exports.onRouteUpdate = ({ location, prevLocation }) => {
let viewName = location.pathname.substr(1, location.pathname.length - 2) || "home";
if (typeof adobe != 'undefined' && adobe.target && typeof adobe.target.triggerView === 'function') {
adobe.target.triggerView(viewName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment