Logging custom values via munchkinFunction() | Community
Skip to main content
December 2, 2016
New

Logging custom values via munchkinFunction()

  • December 2, 2016
  • 3 replies
  • 4101 views

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}}.

3 replies

SanfordWhiteman
Level 10
December 2, 2016

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"

December 5, 2016

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

});


I can barely refer/set the value in SC.

SanfordWhiteman
Level 10
December 5, 2016

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

Grégoire_Miche2
Level 10
December 2, 2016

Duplicates this one:

-Greg

December 5, 2016

Similar but not duplicate

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

SanfordWhiteman
Level 10
December 5, 2016

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

February 6, 2020
No text available