• sergiybond

    (@sergiybond)


    Hi guys,

    Considering the latest release of this feature: https://github.com/mautic/mautic/pull/4850
    that allows passing the cookie value via API, does the plugin support this or do I need to wait for it to be updated?
    Currently, it seems like Mautic will not track any page hits for visitors who convert through Gravity Fors that are synced to Mautic – is there something wrong with my setup perhaps? The Oauth 2 sync is successful and I can see contacts being created through the synced forms, however, I do not see any page hits for them.
    My Mautic tracking code has been installed through an official WP Mautic Plugin and it works fine if I use the native Mautic forms.

    Any help is greatly appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • yankees9920

    (@yankees9920)

    I think I am having a similar problem using Contact Form 7. I will see the events logged (i.e. page visits) from the anonymous user, and then once filling out a form I see a new contact, however it doesn’t link the anonymous user with the one who filled out the form. So the new [known] contact is created with no past event history

    I managed to resolve this issue. The forms must not have kiosk mode enabled, and you want to modify the following function.

    I don’t have time to figure out exactly which of the 3 mods resolves it, but hey it works.
    I think it’s just the first if() statement that’s needed.

    function _push_mautic_form( $query, $formId )
    {
    if( is_array( $query ) && ! empty( $query ) && is_numeric( $formId ) ) {
    $ip = _get_ip();
    $query[‘return’] = get_home_url();
    $query[‘formId’] = $formId;

    $data = array(
    ‘mauticform’ => $query,
    );

    if (isset($_COOKIE[‘mtc_id’]))
    $data[‘mtc_id’] = $_COOKIE[‘mtc_id’];

    $MauticBaseURL = get_option( ‘haw_mautic_base_url’ );
    if ( $MauticBaseURL ) {
    $url = $MauticBaseURL . “/form/submit?formId=” . $formId . (isset($_COOKIE[‘mtc_id’]) ? ‘&mtc_id=’.$_COOKIE[‘mtc_id’] : ”);
    $response = wp_remote_post(
    $url,
    array(
    ‘method’ => ‘POST’,
    ‘timeout’ => 45,
    ‘headers’ => array(
    ‘X-Forwarded-For’ => $ip,
    ),
    ‘body’ => $data,
    ‘cookies’ => $_COOKIE
    )
    );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Passing Cookie Value of Anonymous Visitors’ is closed to new replies.