LLMS_Events::store_tracking_events( string $tracking )

Store event data saved in the tracking cookie.


Description Description


Parameters Parameters

$tracking

(string) (Required) The llms-tracking data in JSON format.


Top ↑

Return Return

((boolean|WP_Error)) Returns WP_Error when nonce verification fails or unauthenticated user, true otherwise.


Top ↑

Source Source

File: includes/class-llms-events.php

	public function store_tracking_events( $tracking ) {

		$tracking = json_decode( $tracking, true );

		if ( ! empty( $tracking['nonce'] ) && wp_verify_nonce( $tracking['nonce'], 'llms-tracking' ) && get_current_user_id() ) {

			if ( ! empty( $tracking['events'] ) && is_array( $tracking['events'] ) ) {

				foreach ( $tracking['events'] as $event ) {

					$event = $this->prepare_event( $event );

					if ( ! is_wp_error( $event ) ) {
						$this->record( $event );
					}
				}
			}
		} else {
			return new WP_Error( 'llms_events_tracking_unauthorized', __( 'You\'re not allowed to store tracking events', 'lifterlms' ) );
		}

		return true;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.37.14 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.