$src, 'key' => $key, 'endpoint' => $endpoint); } function agumail_tracking_enqueue() { if (is_admin() || !agumail_tracking_on()) { return; } $site = agumail_tracking_site(); if (!$site) { return; } // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion -- no version: the address is AguMail's and already carries its own. wp_enqueue_script(AGUMAIL_SITE_HANDLE, $site['src'], array(), null, false); $identify = agumail_tracking_identify_script(); if ($identify !== '') { wp_add_inline_script(AGUMAIL_SITE_HANDLE, $identify, 'after'); } } /** * The script reads its site key and endpoint, and who the visitor is, off its * own tag. It loads async so it never holds up the page, and Cloudflare's * Rocket Loader is told to leave it alone. */ function agumail_tracking_script_tag($tag, $handle, $src = '') { if ($handle !== AGUMAIL_SITE_HANDLE || !agumail_tracking_on()) { return $tag; } $site = agumail_tracking_site(); if (!$site) { return $tag; } $attributes = array('data-site' => esc_attr($site['key']), 'data-endpoint' => esc_url($site['endpoint'])); $identity = agumail_tracking_identity(); if ($identity) { $attributes['data-email'] = esc_attr($identity['email']); if ($identity['sig'] !== '') { $attributes['data-esig'] = esc_attr($identity['sig']); } } $attributes['data-cfasync'] = 'false'; return agumail_script_tag_attributes($tag, $handle, $attributes, true); } /** * Adds already-escaped attributes to the tag that loads $handle's file. * WordPress passes that tag together with the inline scripts around it * (translations, before, after), whose text may itself hold "