__( 'Dealroot leads', 'dealroot' ), 'callback' => array( $this, 'export' ), ); return $exporters; } /** * Adds the eraser. * * @param array $erasers Erasers. * @return array */ public function register_eraser( $erasers ) { $erasers['dealroot'] = array( 'eraser_friendly_name' => __( 'Dealroot leads', 'dealroot' ), 'callback' => array( $this, 'erase' ), ); return $erasers; } /** * Exports leads for an email address. * * @param string $email Email address. * @return array */ public function export( $email ) { $items = array(); foreach ( Leads::by_email( $email ) as $lead ) { $data = array( array( 'name' => __( 'Date', 'dealroot' ), 'value' => get_date_from_gmt( $lead->created_at ), ), array( 'name' => __( 'Form', 'dealroot' ), 'value' => $lead->form_name, ), array( 'name' => __( 'Channel', 'dealroot' ), 'value' => Attribution::channel_label( $lead->channel ), ), ); if ( '' !== Geo::place( $lead->country ?? '', $lead->city ?? '' ) ) { $data[] = array( 'name' => __( 'Location', 'dealroot' ), 'value' => Geo::place( $lead->country ?? '', $lead->city ?? '' ), ); } if ( Clarity::recorded( $lead ) ) { $data[] = array( 'name' => __( 'Microsoft Clarity session', 'dealroot' ), 'value' => '' !== Clarity::url( $lead ) ? Clarity::url( $lead ) : $lead->clarity, ); } foreach ( (array) json_decode( (string) $lead->fields, true ) as $field ) { $data[] = array( 'name' => $field['label'] ?? '', 'value' => $field['value'] ?? '', ); } $items[] = array( 'group_id' => 'dealroot', 'group_label' => __( 'Form submissions', 'dealroot' ), 'item_id' => 'dealroot-lead-' . $lead->id, 'data' => $data, ); } return array( 'data' => $items, 'done' => true, ); } /** * Deletes leads for an email address. * * @param string $email Email address. * @return array */ public function erase( $email ) { $ids = wp_list_pluck( Leads::by_email( $email ), 'id' ); $removed = Leads::delete( $ids ); return array( 'items_removed' => $removed > 0, 'items_retained' => false, 'messages' => array(), 'done' => true, ); } /** * Suggested privacy policy text. */ public function policy_text() { if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) { return; } $text = '
' . __( 'When you submit a form on this website, we store your submission together with information about how you found us: the referring website, the advertising campaign parameters in the link you followed (such as utm_source or gclid), and the first page you visited. This information is stored in a first-party cookie named dealroot_attr for up to the configured number of days and is used only to measure which marketing channels bring us enquiries. It is not shared with third parties unless we report a conversion to the advertising platform that sent you.', 'dealroot' ) . '
'; $text .= '' . __( 'A second cookie named dealroot_path stores how many times you visited and the last pages you viewed, so we can see how you used the website before getting in touch. Visits are also counted in anonymous daily totals per marketing channel that do not identify you.', 'dealroot' ) . '
'; $text .= '' . __( 'With your enquiry we also store the kind of device (smartphone, tablet or computer), its operating system and the browser you used, but not the full identification your browser sends.', 'dealroot' ) . '
'; if ( Settings::get( 'form_stats' ) ) { $text .= '' . __( 'When you start filling in a form, we count it without cookies and without recognising you: only the name of the form, the label of the field you were at when you left, and whether you sent it are added to anonymous daily totals. What you type is not sent this way.', 'dealroot' ) . '
'; } $text .= '' . __( 'While a page of this website is open in front of you, your browser tells us every 20 to 60 seconds, or every few seconds while we look, which page it is and which form, if any, you are filling in, together with a random key that is kept only for this browser tab. What you type is not sent. This lets us see how many people are on the website right now; it is deleted ten minutes after you leave.', 'dealroot' ) . '
'; $text .= '' . __( 'For visits and enquiries we also store the country and city you are in. They are derived on our own server from your IP address or from the time zone of your browser; your IP address itself is not stored and not passed on.', 'dealroot' ) . '
'; $text .= '' . __( 'If your enquiry or order contains a postcode or a town, we use it instead to show the place of the enquiry on our own map.', 'dealroot' ) . '
'; if ( Settings::get( 'ai_enabled' ) ) { $text .= '' . __( 'To answer you faster, the text of your enquiry is summarised by a language model on servers of our software provider Dealroot in the European Union, which also helps us write our answer. Your email address and phone number are removed before; the text is not stored there and not used to train the model.', 'dealroot' ) . '
'; } $text .= '' . __( 'When you place an order, we also store its number, amount and products with the information about how you found us. Your browser keeps the numbers of your last orders and a random key of your last form submission, valid for one day, in its local storage, so an order is counted once and linked to your enquiry.', 'dealroot' ) . '
'; $text .= '' . __( 'If you leave the checkout for the payment, for example at PayPal, your name, email address and phone number from the checkout are kept on our server for one day, so the order that follows can be linked to you. They are deleted when the order arrives or after that day and are not used otherwise.', 'dealroot' ) . '
'; $text .= '' . __( 'If this website uses Microsoft Clarity, your enquiry is linked to the Clarity recording of your visit. The session cookie dealroot_clarity holds the Clarity project ID for this purpose.', 'dealroot' ) . '
'; wp_add_privacy_policy_content( 'Dealroot', wp_kses_post( wpautop( $text, false ) ) ); } /** * Deletes leads past the retention window. */ public function apply_retention() { $days = (int) Settings::get( 'retention_days' ); if ( $days > 0 ) { Leads::purge_older_than( $days ); Events::purge_older_than( $days ); Visits::purge_older_than( $days ); Form_Stats::purge_older_than( $days ); } } }