• Resolved markp

    (@manageuser)


    Hi there,

    I’m trying to capture the GCLID when a user comes to site via a hidden field. When the user lands directly on the page with the form and the GCLID is in the URL, everyting works fine.

    But generally I’m directing users to different product pages, then they navigate to the form, so the GCLID is dropped from the URL.

    Is there anyway to capture in the form with this type of customer journey?

    I’m also storing the GCLID (through tag manager) as a cookie in local storage and I can see that this is passed through on the different pages in devloper tools.

    As an example, I’m using these two URLs to test;

    https://54digital.co.uk/newform/?gclid=direct_to_form_page

    the one above works, as it lands directly on the page with my test form

    but when I use the below

    https://54digital.co.uk/?gclid=to_home_page_then_on

    And then navigate to https://54digital.co.uk/newform/ it isn’t submitted.

    Many thanks,

    Mark

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Zafer – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @manageuser,

    I hope you are doing well today!

    This issue has been flagged to our SLS (Second Line Support) Team so that they can dig into this further. We will post an update here as soon as more information is available.

    Please keep in mind that our SLS Team deals with more complicated issues, so it may take a little longer for us to reply here.

    Thank you for your patience while we look into this further.

    Kind regards,
    Zafer

    Thread Starter markp

    (@manageuser)

    Hi Zafer,

    Great thanks for the reply.. I’ve actually managed to sort this now using google tag manager: I’ve created a variable to store the GLCID from the URL, set a first party cookie with the value of that variable and then used a script (found online) to insert that variable into an empty hidden field into the form.. Can provide more details if needed but it seems to work well.

    Would be interested to know if the support team have a different method too..

    THanks,

    Mark

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @manageuser

    You can try this code as a mu-plugin on dev/staging first. You need to set the hidden field value like the attached image with the macro {gclid}
    https://monosnap.com/file/9pMdT6O5luoIw2IWhavDRlQahRSPDv

    add_filter( 'forminator_field_hidden_field_value', 'wpmudev_populate_gclid_hidden_field', 10, 4 );
    function wpmudev_populate_gclid_hidden_field( $value, $saved_value, $field, $hidden_field ){
    	if ( 'custom_value' == $saved_value && '{gclid}' == $value ) {     
    		$referer = $_SERVER['HTTP_REFERER'];
    		if ( ! empty( $referer ) ) {
    			$queries = array();
    			$path	 = parse_url($referer);
    			parse_str($path['query'], $queries);
    			if ( ! empty( $queries['gclid'] ) ) {
    				$value = sanitize_text_field( $queries['gclid'] );
    			}
    		}
    		
    	}
    	return $value;
    }

    Kind Regards,
    Kris

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @manageuser ,

    We haven’t heard from you for some time now, so it looks like you don’t have any more questions for us.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Capture GCLID across a different page’ is closed to new replies.