You are here

commerce_google_analytics.rules.inc in Commerce Google Analytics 7.2

Same filename and directory in other branches
  1. 7 commerce_google_analytics.rules.inc

File

commerce_google_analytics.rules.inc
View source
<?php

/**
 * Implements hook_rules_action_info().
 */
function commerce_google_analytics_rules_action_info() {
  return array(
    // Add rules action which sends the analytics code
    'commerce_google_analytics_send_order' => array(
      'label' => t('Send order to google analytics'),
      'group' => t('Commerce Google Analytics'),
      'parameter' => array(
        'commerce_order' => array(
          'type' => 'commerce_order',
          'label' => t('Order in checkout'),
        ),
        'method' => array(
          'type' => 'text',
          'label' => t('Method'),
          'description' => t("Select ga_push method. Server-side methods are recommended"),
          'options list' => 'ga_push_get_methods_option_list_ecommerce',
          'default value' => GA_PUSH_METHOD_DEFAULT,
          'optional' => FALSE,
        ),
      ),
      'callback' => array(
        'execute' => 'commerce_google_analytics_send_order',
      ),
    ),
    // Add rules action that stores Analytics cid with order.
    'commerce_google_analytics_save_ga_session_to_order' => array(
      'label' => t('Save google analytics session to order'),
      'group' => t('Commerce Google Analytics'),
      'parameter' => array(
        'commerce_order' => array(
          'type' => 'commerce_order',
          'label' => t('Order to Update'),
        ),
      ),
      'callback' => array(
        'execute' => 'commerce_google_analytics_save_ga_session_to_order',
      ),
    ),
    // Add rules action that stores User Agent (ua) with order.
    'commerce_google_analytics_save_ga_ua_to_order' => array(
      'label' => t('Save google analytics user agent to order'),
      'group' => t('Commerce Google Analytics'),
      'parameter' => array(
        'commerce_order' => array(
          'type' => 'commerce_order',
          'label' => t('Order to Update'),
        ),
      ),
      'callback' => array(
        'execute' => 'commerce_google_analytics_save_ga_ua_to_order',
      ),
    ),
    // Add rules action that stores User's IP with order.
    'commerce_google_analytics_save_ga_uip_to_order' => array(
      'label' => t('Save google analytics user ip to order'),
      'group' => t('Commerce Google Analytics'),
      'parameter' => array(
        'commerce_order' => array(
          'type' => 'commerce_order',
          'label' => t('Order to Update'),
        ),
      ),
      'callback' => array(
        'execute' => 'commerce_google_analytics_save_ga_uip_to_order',
      ),
    ),
  );
}