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
Property | Type | Description |
---|---|---|
feedName | string | A unique name for the feed. |
submission_parameters | array | An array defining custom submission parameters. Each entry includes a key , custom_key , value , and custom_value . |
key | string | The parameter key. |
custom_key | string | A custom key value for the parameter. For example, parameter_name . |
value | string | The Field ID used to populate the parameter |
custom_value | string | A custom value for the parameter (can be empty). |
feed_condition_conditional_logic | string | Specifies whether feed conditional logic is enabled ('1' for true or '0' for false). |
feed_condition_conditional_logic_object | array | An array that would store the conditional logic rules (empty if conditional logic is not used). |
conditionalLogic | string | Specifies conditional logic settings (empty if not used). |