Google Analytics Feed Meta

Introduction

The Feed Object meta for the Google Analytics Add-on is an associative array containing the properties which determine how the add-on should process the form submission.

$feed['meta'] = array(
    'feedName' => 'Google Analytics Feed 3',
    'submission_parameters' => array(
        array(
            'key'         => 'gf_custom',
            'custom_key'  => 'parameter_name',
            'value'       => '1',
            'custom_value'=> '',
        ),
    ),
    'feed_condition_conditional_logic_object' => array(
        'conditionalLogic' => array(
            'actionType' => 'show',
            'logicType'  => 'all',
            'rules'      => array(
                array(
                    'fieldId'  => '1',    
                    'operator' => 'isnot',
                    'value'    => '',
                )
            ),
        ),
    ),
    'feed_condition_conditional_logic' => '1',
    'conditionalLogic'                 => '',
);

Usage

We recommend accessing the $feed meta using the rgar() or rgars() functions, e.g.:

$conditional_logic_enabled = rgars( $feed, 'meta/feedCondition' );

if ( $conditional_logic_enabled ) {
    // Conditional logic is enabled for this feed.
    $logic_rules = rgars( $feed, 'meta/feed_condition_conditional_logic_object/conditionalLogic/rules' );
    foreach ( $logic_rules as $rule ) {
        // Process each conditional logic rule.
        $field_id  = rgar( $rule, 'fieldId' );
        $operator  = rgar( $rule, 'operator' );
        $value     = rgar( $rule, 'value' );
        // Example: Use $field_id, $operator, and $value in your logic.
    }
}

Properties

PropertyTypeDescription
feedNamestringA unique name for the feed.
submission_parametersarrayAn array defining custom submission parameters. Each entry includes a key, custom_key, value, and custom_value.
keystringThe parameter key.
custom_keystringA custom key value for the parameter. For example, parameter_name.
valuestringThe Field ID used to populate the parameter
custom_valuestringA custom value for the parameter (can be empty).
feed_condition_conditional_logicstringSpecifies whether feed conditional logic is enabled ('1' for true or '0' for false).
feed_condition_conditional_logic_objectarrayAn array that would store the conditional logic rules (empty if conditional logic is not used).
conditionalLogicstringSpecifies conditional logic settings (empty if not used).