• Resolved Austin

    (@austindillman)


    I’m trying to pass a GCLID parameter from Google AdWords to Salesforce through my form. I’ve set everything up in Salesforce as outlined here. I’m not quite sure what to do on step 3 where it talks about adjusting the web-to-lead form since I’m using your plugin rather than generating a standard web-to-lead form.

    I believe the script below has to run to populate the GCLID field. Where would I insert this code? Thanks

    Once you have created this new hidden input field, add it to your HTML form in between the <form> tags. On the same HTML lead submission page, add the following code between the head tags:
    <script>
    window.onload = function getGclid() {
    document.getElementById(“xxxx”).value = (name = new
    RegExp(‘(?:^|;\\s*)gclid=([^;]*)’).exec(document.cookie)) ?
    name.split(“,”)[1] : “”; }
    // window.onload() may not be supported by all browsers.
    // If you experience problems submitting the GCLID as a
    // hidden field, consider using an alternate method to
    // call this function on page load.
    </script>

    https://www.ads-software.com/plugins/salesforce-wordpress-to-lead/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Nick Ciske

    (@nickciske)

    1. Add a custom field at SalesForce to store the data.

    2. Add a hidden field to your form using the editor using the API Name e.g. YOUR_FIELD_NAME__c.

    3. Replace xxxx with the field ID (will look like id="sf_YOUR_FIELD_NAME__c").

    4. Add the custom script to your form page using a plugin like:
    https://www.ads-software.com/plugins/javascript-per-page/

    FYI – This Javascript should be safer/more reliable that the one you posted.

    jQuery(document).ready(function() {
        document.getElementById("xxxx").value = (name = new RegExp('(?:^|;\\s*)gclid=([^;]*)').exec(document.cookie)) ?
            name.split(",")[1] : "";
    });

    Plugin Author Nick Ciske

    (@nickciske)

    Did you get this figured out?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Passing AdWords GCLID to Saleforce’ is closed to new replies.