log_noptin_subscriber_campaign_click( int $subscriber_id, string $campaign_id, string $link )

Logs whenever a subscriber clicks on a link in an email


Parameters Parameters

$subscriber_id

(int) (Required) Subscriber ID.

$campaign_id

(string) (Required) The email campaign.

$link

(string) (Required) The clicked link.


Top ↑

Source Source

File: includes/subscriber.php

function log_noptin_subscriber_campaign_click( $subscriber_id, $campaign_id, $link ) {

	log_noptin_subscriber_campaign_open( $subscriber_id, $campaign_id );

	$clicked_campaigns = get_noptin_subscriber_clicked_campaigns( $subscriber_id );

	if ( ! isset( $clicked_campaigns[ $campaign_id ] ) ) {
		$clicked_campaigns[ $campaign_id ] = array();
	}

	if ( ! in_array( $link, $clicked_campaigns[ $campaign_id ], true ) ) {
		$clicked_campaigns[ $campaign_id ][] = noptin_clean( $link );
		update_noptin_subscriber_meta( $subscriber_id, '_clicked_campaigns', $clicked_campaigns );
		update_noptin_subscriber_meta( $subscriber_id, "_campaign_{$campaign_id}_clicked", 1 );

		$click_counts = (int) get_post_meta( $campaign_id, '_noptin_clicks', true );
		update_post_meta( $campaign_id, '_noptin_clicks', $click_counts + 1 );

		do_action( 'log_noptin_subscriber_campaign_click', $subscriber_id, $campaign_id, $link );
	}

}


Top ↑

Changelog Changelog

Changelog
VersionDescription
1.2.0Introduced.

Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation