latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Hook for free user signups tracking

Home Forums Community Forum Hook for free user signups tracking

This topic contains 2 replies, has 3 voices. Last updated by  Jason (Lead Developer) 4 years, 11 months ago.

Topic Author Topic
Posted: Thursday Feb 9th, 2012 at 7:52 am #4590
Ryan Ghods
Username: ralxz

I am aware that I can track conversions for users who signup through a payment gateway through the API tracking, and that is working fine.

However, I’d like to also track free user signups as well. Is there some code I can use as a hook (in s2-hacks) to execute a certain block of code when a user signs up through the free user registration form? So I could put my AdWords conversion code in there, for example.

Thanks!
Ryan

List Of Topic Replies

Viewing 2 replies - 1 through 2 (of 2 total)
Author Replies
Author Replies
Posted: Thursday Feb 9th, 2012 at 11:09 am #4634
Bruce
Username: Bruce
Staff Member

Hi Ryan,

You can probably do this through the WordPress hook user_register. You can just check if the
user_is($id, 'subscriber')

So you would do something like this:

<?php
add_action ('user_register', 'my_s2memberlevel0_function');
/**/
function my_s2memberlevel0_function($id) // The hook already passes the id of the user that's created
	{
		if(user_is($id, "subscriber")) // If the user that was created is a free Subscriber
			{
				// Your process (Keep in mind that you cannot echo or print values here)
			}
	}
?>

This code executes right after the user presses the button to create the account, and right before they are redirected to the WordPress® login screen, therefore if you need to echo out any JavaScript, etc. after signup, you’ll need to assign a value (probably through update_user_meta) and check the value after user is logged in, and then delete the user_meta value.

I hope that helps,

Bruce

WordPress® add_action()

s2Member® user_is()

Posted: Thursday Feb 9th, 2012 at 7:00 pm #4692
Staff Member

Hi Ryan. Thanks for your inquiry.

Are you running s2Member Pro Forms for free registration,
or using the default WordPress Registration Form?

Viewing 2 replies - 1 through 2 (of 2 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.