Moving the discussion on Custom Activities in Marketo here to Products as the other place doesn't have a syntax highlighter.
Supporto BOARD as I was saying, even if your pages use the pathname for the search terms, we can transfer them into the query string (this will be cosmetic from the standpoint of the search engine, but Munchkin will log it for us) to take more intelligent action on the Marketo server.
Using this code, you'll end up with a Visit Web Page hit to /transferred-search-terms with {{trigger.Search Query}} available for use:
(function(loc){
var transferLoc = document.createElement('a'),
pathParts;
transferLoc.href = loc.href;
if( pathParts = transferLoc.pathname.match(/\/search\/node\/(.*)/) ){
transferLoc.search = "s=" + pathParts[1];
history.replaceState({}, null, transferLoc.href);
Munchkin.munchkinFunction( "visitWebPage", { url : "/transferred-search-terms" });
}
})(document.location);
Thanks for this, Sanford! I'll need to have someone more technical to look at this, but just to see if I understood correctly, do we need to put this code only on the search results page or is it needed throughout the site (or at least on the pages from where visitors can use the search)?
Just on the search results page, but it also double-checks to see if it's on a page with /search/node in the URL, so it's harmless if you put it everywhere.
Oh, and it has to go after where you run Munchkin.init().