# wp-parsely/2.1.1/parsely-javascript.php

Parse.ly, version 2.1.1. 60 lines.

- Page: https://pluginprobe.com/plugins/wp-parsely/2.1.1/code/parsely-javascript.php
- Raw: https://pluginprobe.com/plugins/wp-parsely/2.1.1/raw/parsely-javascript.php
- Modified: 2020-06-08T22:01:28+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-parsely/2.1.1/code/parsely-javascript.php#L10-L20`.

```php
<?php
/**
 * JavaScript file
 *
 * Main javascript file for plugin
 *
 * @category   Components
 * @package    WordPress
 * @subpackage Parse.ly
 */

?>

<?php
if ( ! isset( $parsely_options['apikey'] ) || empty( $parsely_options['apikey'] ) ) {
	return;
}
?>

<!-- START Parse.ly Include: Standard -->
<?php if ( ! empty( $parsely_options['api_secret'] ) ) : ?>
	<script data-cfasync="false">

		function uuidProfileCall() {
			var rootUrl = 'https://api.parsely.com/v2/profile?apikey=<?php echo esc_html( $parsely_options['apikey'] ); ?>';
			var uuid = '&uuid=' + PARSELY.config.parsely_site_uuid;
			var requestUrl = rootUrl + uuid + '&url=' + window.location.href;
			jQuery.ajax({
				url: requestUrl,
				dataType: "jsonp"
			});
		}

		if (typeof PARSELY == 'object') {
			var oldonload = PARSELY.onload;
			if (typeof PARSELY.onload != 'function') {
				PARSELY.onload = uuidProfileCall
			}
			else {
				PARSELY.onload = function () {
					if (oldonload) {
						oldonload();
					}
					uuidProfileCall();
				};
			}
		}

		else {
			PARSELY = {
				onload: uuidProfileCall
			}
		}
	</script>
<?php endif; ?>

<script data-cfasync="false" id="parsely-cfg" data-parsely-site="<?php echo esc_attr( $parsely_options['apikey'] ); ?>" src="//cdn.parsely.com/keys/<?php echo esc_attr( $parsely_options['apikey'] ); ?>/p.js"></script>

<!-- END Parse.ly Include: Standard -->

```
