groundhogg/tracking/target_url

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Filter Hooks

Β»

groundhogg/tracking/target_url

Filters the destination URL a contact is redirected to when they click a tracked link in an email. Use this to modify or validate redirect destinations.

apply_filters( 'groundhogg/tracking/target_url', $target_url );

You will receive the target URL string.

Example

add_filter( 'groundhogg/tracking/target_url', 'my_extension_append_utm_params' );

/**
 * Append UTM parameters to all tracked link destinations.
 *
 * @param string $target_url
 *
 * @return string
 */
function my_extension_append_utm_params( $target_url ) {
    return add_query_arg( [
        'utm_source'   => 'groundhogg',
        'utm_medium'   => 'email',
    ], $target_url );
}

Was this helpful?

Let us know if this document answered your question. That’s the only way we can improve.