User Email Merge Tag

I have a reserved area created with Gravity login registration and I show the login form through a page with the widget created by the plugin. I need to declare the merge tag of the user’s e-mail address {user: user_email} as a variable because this data must be declared in an external script that I have to paste in the header of the login page. The script is as follows:

<script>
   _etmc.push (["setUserInfo", {"email": example}]);
   _etmc.push (["trackPageView"]);
</script>

In this case, the “example” variable must therefore correspond to the user’s email address.
I tried to enter {user: user_email} directly but it doesn’t return the dynamic value for each user who logs in (if you don’t log in the field must be empty).

I also tried to insert (along with the code above) another snippet
<script> var example = "{user: user_email}" </script>
but it doesn’t take the email field of the form.

Thanks for your appreciate support!

Merge tags are only for use inside Gravity Forms scope, like confirmations, notifications or Default Value for a field. So adding it to your script is not going to work.

The merge tag is just a way to put information from WordPress into Gravity Forms, in this case I don’t see any reason to use it as your goal is to let your script get the information not Gravity Forms. Your best bet would be to just get the information from WordPress directly using WordPress functions, you can find some examples here.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.