Logging custom values via munchkinFunction()

0 Likes

Logging custom values via munchkinFunction()

Currently, Munchkin.munchkinFunction() supports "visitWebPage" "clickLink" and "associateLead" activity types.

See http://developers.marketo.com/javascript-api/lead-tracking/api-reference/

I want to log additional info from JS without Forms2.

For example

Munchkin.munchkinFunction("myCunstomActivity", { fieldName: "Geo", fieldValue: "Tokyo" } );

Background

- Include anonymous leads

- The flow step does not support {{trigger.query parameter}}.

10 Comments
Level 10 - Community Moderator

I have a feeling this is never going to happen -- if it were, Custom Activities wouldn't have been rolled out in an obscure and batch-centric fashion.

However:

Munchkin.munchkinFunction('visitWebPage', {

  url: '/postFieldValue/Geo',

  params: 's=Tokyo'

});

{{trigger.search query}} == "Tokyo"

Duplicates this one:

-Greg

Anonymous
Not applicable

Similar but not duplicate

If Munchkin.munchkinFunction('visitWebPage', { } ) or standard new activity will support custom values, it's ok.

Level 10 - Community Moderator

How could there be custom properties + values without that being the equivalent to a Custom Activity?

Anonymous
Not applicable

I tried to set {{trigger.search query}}  but I can't.

My poor idea

Munchkin.munchkinFunction('visitWebPage', {

  url: '/geo/'+ encodeURIComponent(address),

  params: 'geocode=' + latitude + "," + longitude

});

Screen Shot 2016-12-05 at 11.25.25.png

I can barely refer/set the value in SC.

Level 10 - Community Moderator

Sorry, I forgot how my own trick works. You have to set the s attribute of the current URL to the value you're passing, then run the Visit Web Page.

var newLoc = document.createElement('A');

newLoc.href = document.location.href;

newLoc.search = 's=' + encodeURIComponent(address);

history.replaceState({},null,newLoc);

Munchkin.munchkinFunction('visitWebPage', { url: '/postFieldValue/geo' });

See also Re: Capturing Lead Source Using UTM Fields

Anonymous
Not applicable
Anonymous
Not applicable

Thank you Sanford Whiteman

What a great solution!

Works fine.

Screen Shot 2016-12-05 at 18.07.42.png

Level 10 - Community Moderator

Awesome!

Community Manager
Status changed to: Open Ideas