Automator_Notifications::url_add_utm( mixed $url = '', mixed $campaign = '', mixed $content = '' )

Add UTM parameters to any links.


Parameters Parameters

$url

(Optional) The url of the button.

Default value: ''

$campaign

(Optional) The title of the button. Urlencoded with spaces replaced by dash.

Default value: ''

$content

(Optional) The button tex. Urlencoded with spaces replaced by dash.

Default value: ''


Top ↑

Return Return

(string) The link with utm specified parameters.


Source Source

File: src/core/admin/notifications/notifications.php

	public function url_add_utm( $url = '', $campaign = '', $content = '' ) {

		if ( empty( $url ) ) {
			return '';
		}

		return add_query_arg(
			array(
				'utm_medium'   => 'notification',
				'utm_campaign' => str_replace( ' ', '-', $campaign ),
				'utm_content'  => str_replace( ' ', '-', $content ),
				'utm_source'   => 'uncanny_automator',
			),
			$url
		);

	}