Question

Used Code by Zapier to try to grab UTMs with dynamic java seen on here, UTMs do not come through from the URL. Any ideas?

  • 8 April 2022
  • 2 replies
  • 394 views

I used the code below in my zapier workflow to --- capture UTM info when a lead takes action on our website, fills out a form, then gets routed into pardot/salesforce. 

 

Steps:

1: webhook

  1. code for UTMs
  2. prospect routing through pardot/salesforce

 

I used for URL: http://site.com?utm_source=source&utm_campaign=campaign&utm_medium=medium&utm_term=term&utm_content=content

 

and the code I used: 

 

const url = inputData.url; // http://example.com?

const urlObject = new URL(url);

const id = urlObject.searchParams.get('id')

console.log(id)

// prints

const utm_term = urlObject.searchParams.get('utm_term');

const fbclid = urlObject.searchParams.get('fbclid');

const gclid = urlObject.searchParams.get('gclid');

const gacid = urlObject.searchParams.get('gacid');

const utm_campaign = urlObject.searchParams.get('utm_campaign');

const utm_content = urlObject.searchParams.get('utm_content');

const utm_medium = urlObject.searchParams.get('utm_medium');

const utm_source = urlObject.searchParams.get('utm_source');

output = {

"utm_term":utm_term,

"gclid":gclid,

"fbclid":fbclid,

"gacid":gacid,

"utm_source":utm_source,

"utm_campaign":utm_campaign,

"utm_medium":utm_medium,

"utm_content":utm_content,

};


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Any help would be greatly appreciated!

Userlevel 7
Badge +14

Hi @SDC 

Good question.

Check out this help topic: