Install Userpilot on WordPress Sites

Userpilot comes with a native WordPress plugin, and integrating it with your WordPress site is easy.

First, log in to your WordPress site and click "Add New" on your plugins page.

Next, search for and install the Userpilot plugin.

After you successfully add the plugin, include the Userpilot script in the space shown below.

We encourage you to use the following code to differentiate between logged in users (or users on logged in pages such as the admin panel) and anonymous users on pages where users are logged out.

The following code simply passes user data using the userpilot.identify() function when users are logged in, and executes the userpilot.anonymous() function for pages where users are logged out.

<script src="<a href="">{{app_token}}.js"></script</a>><br><?php<br>if(is_user_logged_in())<br>{<br>	$user = get_userdata(get_current_user_id())->data;<br>	$id = $user->ID;<br>	$name = $user->user_nicename;<br>	$email = $user->user_email;<br>	$createdAt = strtotime($user->user_registered);<br>?><br><br><script><br><br>userpilot.identify("<?php echo $id; ?>",  {<br>	name:"<?php echo $name; ?>",<br>	email:"<?php echo $email; ?>",<br>	created_at:"<?php echo $createdAt; ?>"<br>});<br><br><br></script><br>    <br><?php<br><br>}else{<br>	?><br>	<script><br>		userpilot.anonymous();<br>	</script><br>	<?php<br>}<br><br> ?>

IMPORTANT: If you are going to copy-paste the above example code, then don't forget to fill in the "App Token" with your own app token.

You must also pass the "UNIQUE USER ID" to help Userpilot identify each user.

It's also a very good idea to pass other user attributes such as Full Name, Email Address and Created_at as shown in the instructions above to help you target certain user segments such as new users.

After your done, you can select which pages to activate the Userpilot script on as shown below.

Then, simply hit "save changes" and you're all done.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.