How to display call-to-action based on URL parameter

The cp_pro_target_page_settings filter allows you to display call-to-action based on GET parameter in your URL.

Following is the sample code which can be used to display call-to-action based on UTM parameter in URL. You can add this code to your theme’s functions.php.

/**
 * Display call-to-action based on URL parameter
 */
function cpro_check_url_parameter( $display, $style_id ) {

	// Replace 93 with your style ID
	if( '93' == $style_id ) {

		// Replace "utm" with your GET parameter from URL, replace "facebook" with your parameter value
		if( isset( $_GET['utm'] ) && 'facebook' == $_GET['utm'] ) {
			$display = true;
		} else {
			$display = false;
		}
	}

	return $display;
}
add_filter( 'cp_pro_target_page_settings', 'cpro_check_url_parameter', 10, 3 );

Where can I find the ID of the call-to-action?
Open Convert Pro dashboard and click on the info icon seen under the Insight column in line with the call-to-action name.

You’ll find the ID as highlighted in the screenshot below.

You can also see the ID in the URL when you open the particular call-to-action in the editor. Refer screenshot.

Not the solution you are looking for? Check other articles, or open a support ticket.