Giter Club home page Giter Club logo

Comments (2)

zaus avatar zaus commented on August 12, 2024

These issue threads are technically supposed to be for problems with the plugin code, or requests for enhancements, but I understand not knowing where else to go. The Wordpress support forums for the plugin are more appropriate, but since they don't send the author emails by default it's harder to get an "official" response, and you're more at the mercy of whichever kind soul stumbles upon your problem.

Now that that's out of the way, to your question:

ClickDimensions' setup is almost ideal for this plugin, except for the fact that you need a cookie value and setting a header, which I don't support out of the box. I ended up putting all the "unusual" field values in another add-on for this plugin, Dynamic Fields, which would be a great place to add support for cookies (now it's an Issue).

For now, you'll want to hook to service_filter_post (actually Forms3rdpartyIntegration_service_filter_post) and grab the cookie value, something like:

add_filter('Forms3rdPartyIntegration_service_filter_post', 'my_extension_cookie_post_filter'), 10, 3);
function my_extension_cookie_post_filter($post, $service, $form) {
    $post['cd_visitorkey'] = $_COOKIE['cuvid'];
    return $post;
}

Adding headers is somewhat similar -- you can already do this with another add-on Forms 3rdparty Xpost, but if you want to do it with the same hook as your cookies, you can use service_filter_args and modify both the body and the headers keys (same as xpost):

add_filter('Forms3rdPartyIntegration_service_filter_args', 'my_extension_modify_request'), 10, 3);
function my_extension_modify_request($args, $service, $form) {
    $args['body']['cd_visitorkey'] = $_COOKIE['cuvid'];
    // just in case there are already headers...
    if(isset($args['headers'])) {
        $args['headers'] = array_merge( (array)$args['headers'], $headers );
    }
    else {
        // here, set it to the current page via `get_permalink()`
        // or one of the fields you mapped in `$args['body']`, or a static value
        $args['headers'] = array( 'Referer' => $args['body']['some_field_i_decided'] );
    }
    return $args;
}

from forms-3rdparty-integration.

pw3010 avatar pw3010 commented on August 12, 2024

Hi Zaus, thanks so much for getting back to me on this. I'll give the filters a try.

Pete

from forms-3rdparty-integration.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.