su_get_utm_link

The shortcodes-ultimate su get utm link function.

Published Date - February 15, 2021

Description

Helper function to add utm-args to an URL.

su_get_utm_link( $url, $utm );

Parameters

  1. $url

  2. $utm


Usage

The following example is for adding a hook callback.

if ( !function_exists( 'su_get_utm_link' ) ) {
    require_once ABSPATH . PLUGINDIR . 'shortcodes-ultimateshortcodes-ultimate/includes/functions-helpers.php';
}

// The input(s). 
$url = null;
$utm = null;

// NOTICE! Understand what this does before running.
$result = su_get_utm_link( $url, $utm );
            

Defined

The function is defined in the following location(s).

shortcodes-ultimate/includes/functions-helpers.php

function su_get_utm_link( $url, $utm ) {

	return add_query_arg(
		array(
			'utm_source'   => $utm[0],
			'utm_medium'   => $utm[1],
			'utm_campaign' => $utm[2],
		),
		$url
	);

}