|
/ Documentation /Advanced/ How to display call-to-action based on URL parameter

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.

Info Button in Convert Pro Dashboard

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

CTA ID in Convert Pro Information

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

Call To Action ID in URL
Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page

Compare Convert Pro with...

29439
29440
Scroll to Top