SOLVED

Re: Extract PathFactory "Visits Webpage" Query Parameters

Go to solution
Sean_Day3
Level 2

Extract PathFactory "Visits Webpage" Query Parameters

We've been increasingly using PathFactory as a way to surface "non-gated" resources to our customer base. So far it has been great for customers since we don't post the assets anywhere besides on internal customer communities or though email were we're able to associate everyone back to an email click or direct response campaign.

Since we've seen success with our customer audience our demand generation team has gained interest in the tool and wants to begin leveraging it as a prospecting tool through channels like paid and partner. 

Currently when someone visits a PathFactory page and reaches a threshold score (let's say views a PDF for 60 seconds), the PathFactory their integration makes a pushes an event to Marketo and records a "Visits Web Page" activity for the known individual. Because this is not a true "Visits Web Page" activity coming from our website and the activity comes through the API we're unable to add any JavaScript that we'd normally use to pull the query parameters out of the URL and write them to hidden form fields.

So my question for the community is: Is there a way to 1. parse the query parameter from an API-created visits web page event and 2. write the parsed query parameters to the fields we would normally write to when known people visit our website. 

Been looking for similar questions in the community but most solutions proposed are around posting a hidden form fill which would only work on our owned web properties where we can leverage some JavaScript.

Thanks in advance for the help!

1 ACCEPTED SOLUTION

Accepted Solutions
Sean_Day3
Level 2

Re: Extract PathFactory "Visits Webpage" Query Parameters

Hey Sanford Whiteman‌ I spent some time on this challenge this afternoon and came up with a solution using Flowboost (thank you sir!)

My solution to this is when PathFactory pushes the data over as a visits web page event to add a step in my flow where I leverage the {{trigger.referrer}} token to write the value of the full referral URL to a custom field on the person.

Then when that field is populated I make a call to Flowboost where I built a little script that could parse the query string and store the UTM values as key:value array within the returned variable. Then just had to map each of the keys to our UTM fields on the person level. 

Code used for my Flowboost webhook body was:

var url = {{lead.triggerReferrer}};

function getUrlVars(url) {
var vars = {};
var parts = url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}

var queryParams = getUrlVars(url);

The resulting response from FB was:

{
"url": "https://content.khoros.com/pf-summer-innovation-release/customer-care-playbook?utm_source=marketo&utm_medium=email&utm_campaign=seans+test+trigger+solution&utm_content=type&utm_term=text+type",
"queryParams": {
"utm_source": "marketo",
"utm_medium": "email",
"utm_campaign": "seans+test+trigger+solution",
"utm_content": "type",
"utm_term": "text+type"
}
}

This isn't by any means fail proof but for the purposes here works like a charm!

This was the first time I've used FB for anything besides some simple tests of adding scores together so huge thank you since I've been sitting on my API key since March!

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Extract PathFactory "Visits Webpage" Query Parameters

You need to be more specific about the "API" in this scenario. Are they using the client-side Munchkin API (as they should, for scaleability)?  In that case they are completely in control of what they send you. If they don't include the query string, then you won't have it, either.

Sean_Day3
Level 2

Re: Extract PathFactory "Visits Webpage" Query Parameters

Hey Sanford, you're correct they're leveraging the client-side Munchkin API.

They're including the query string in the data push but since they push it through as an attribute (might not be the right term based on the screenshot above) of the activity and not to a field there's not really an elegant way that I can figure out to extract that down to a field on the person-level.

Sean_Day3
Level 2

Re: Extract PathFactory "Visits Webpage" Query Parameters

Hey Sanford Whiteman‌ I spent some time on this challenge this afternoon and came up with a solution using Flowboost (thank you sir!)

My solution to this is when PathFactory pushes the data over as a visits web page event to add a step in my flow where I leverage the {{trigger.referrer}} token to write the value of the full referral URL to a custom field on the person.

Then when that field is populated I make a call to Flowboost where I built a little script that could parse the query string and store the UTM values as key:value array within the returned variable. Then just had to map each of the keys to our UTM fields on the person level. 

Code used for my Flowboost webhook body was:

var url = {{lead.triggerReferrer}};

function getUrlVars(url) {
var vars = {};
var parts = url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}

var queryParams = getUrlVars(url);

The resulting response from FB was:

{
"url": "https://content.khoros.com/pf-summer-innovation-release/customer-care-playbook?utm_source=marketo&utm_medium=email&utm_campaign=seans+test+trigger+solution&utm_content=type&utm_term=text+type",
"queryParams": {
"utm_source": "marketo",
"utm_medium": "email",
"utm_campaign": "seans+test+trigger+solution",
"utm_content": "type",
"utm_term": "text+type"
}
}

This isn't by any means fail proof but for the purposes here works like a charm!

This was the first time I've used FB for anything besides some simple tests of adding scores together so huge thank you since I've been sitting on my API key since March!

SanfordWhiteman
Level 10 - Community Moderator

Re: Extract PathFactory "Visits Webpage" Query Parameters

Awesome! FB actually has a macro to make that even easier:

var url = {{lead.triggerReferrer}};
var queryParams = FBHttp.parseUrl(url).query;