I
I
Ilya Dorovskikh2022-02-16 13:33:24
CRM
Ilya Dorovskikh, 2022-02-16 13:33:24

Is there a plugin in WordPress that fixes referrals for a partner when filling out contact details?

Good afternoon!

We need a functional that would record requests for a partner using his link.
That is, not selling goods and not registering, but filling out a form.

As a result, there should be a table containing the data:
Partner, Date/time of the application, Application data (Name, E-mail, phone, etc.).

At the moment, I have not found this in all the options I have looked at.

Please tell me the solution.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Zolin, 2022-02-17
@artzolin

Your task is not universal, but the implementation is quite simple Add your variable
to the arrayquery_vars

add_filter( 'query_vars', 'add_query_vars' );
function add_query_vars( $qvars ) {
  $qvars[] = 'partner';
  return $qvars;
}

Now for any link like example.ru/?partner=15 you can get the partner number usingget_query_var()
if ( $query_var = get_query_var( 'partner' ) ) {
  # code...
}

Put it in localstorage or cookie , and when creating an application, check for existence and write it to the table. As a partner number, you can use the user id or an arbitrary number, after putting it in user_meta You can
collect an affiliate link using the functionadd_query_arg()
$url = add_query_arg( ['partner' => $user_id], home_url( '/' ) );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question