The gform_aweber_ad_tracking filter is used to modify the ad_tracking parameter value before it is sent to AWeber.
Usage
add_filter('gform_aweber_ad_tracking', 'your_function_name', 10, 4);
To limit the scope of the filter to a single form, append the form ID to the hook name:
add_filter('gform_aweber_ad_tracking_5', 'your_function_name', 10, 4);
Parameters
$ad_tracking
(string) – The default value of the ad_tracking parameter is the form title.$form
(Form Object) – The Form which is currently being processed.$entry
(Entry Object) – The Entry which is currently being processed.$feed
(Feed Object) – The Feed which is currently being processed.
More information
See Gravity Forms Docs: gform_aweber_ad_tracking
Examples
Change Ad Tracking Value
Modify the ad_tracking parameter value before sending to AWeber.
function change_ad_tracking_value($ad_tracking, $form, $entry, $feed) { // Your custom code here return 'your new value'; } add_filter('gform_aweber_ad_tracking', 'change_ad_tracking_value', 10, 4);
Add Entry ID to Ad Tracking Value
Append the entry ID to the ad_tracking parameter value.
function append_entry_id($ad_tracking, $form, $entry, $feed) { // Your custom code here return $ad_tracking . '-' . $entry['id']; } add_filter('gform_aweber_ad_tracking', 'append_entry_id', 10, 4);
Add Current Date to Ad Tracking Value
Add the current date to the ad_tracking parameter value.
function add_current_date($ad_tracking, $form, $entry, $feed) { // Your custom code here return $ad_tracking . '-' . date('Y-m-d'); } add_filter('gform_aweber_ad_tracking', 'add_current_date', 10, 4);
Use Form Field Value as Ad Tracking Value
Use a form field value (e.g., with the field ID 10) as the ad_tracking parameter value.
function use_form_field_value($ad_tracking, $form, $entry, $feed) { // Your custom code here return $entry[10]; } add_filter('gform_aweber_ad_tracking', 'use_form_field_value', 10, 4);
Use Custom Value for Specific Form
Modify the ad_tracking parameter value for a specific form (e.g., form ID 5).
function specific_form_ad_tracking($ad_tracking, $form, $entry, $feed) { // Your custom code here return 'custom-value'; } add_filter('gform_aweber_ad_tracking_5', 'specific_form_ad_tracking', 10, 4);