• Resolved 63N

    (@63n)


    I’m looking for a way to add a specific tag to a contact when they sign up through a specific signup form.

    E.g. when someone signs up via the homepage signup form they get a tag like ‘homepage signup’.

    E.g. when a customer buys something via WooCommerce checkout and checks the button to sign up, they get the tag ‘web store customer’.

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Constant Contact

    (@constantcontact)

    Hi @63n

    Biggest question I have, besides for some general tracking of origin, is where are you hoping to store this information? As is, it could be part of email notifications, or it could be part of perhaps a custom field. A custom field option would get the data included in the contact itself in your Constant Contact list/dashboard.

    Only potential downside for the custom field is that there’d need to be a touch of JS or similar to prevent the user from removing the value accidentally.

    Trying to think of potentially the best way to help with this, while also not preventing successful list additions from unknown fields in the API request.

    Thread Starter 63N

    (@63n)

    I would expect it to use the built-in tags in Constant Contact? As for how that gets submitted from the form, that’s what I’m trying to work out.

    I’m not sure I understand what you mean by ‘it could be part of email notifications’.

    I’ve done this before pretty easily in MailChimp, so am pretty surprised there isn’t a documented way of doing this with Constant Contact.

    Plugin Author Constant Contact

    (@constantcontact)

    Noted on your location intent, I was asking to confirm because as far as I’m presently aware, we don’t have a dedicated field to store that specific type of information. All the fields we have available when creating a form, are already mapped to pre-existing locations in a contact in the Constant Contact Dashboard.

    However, we have the custom fields and custom textarea spots available for just that, custom information. However, the caveat of those two types are that they are not hidden fields like the Mailchimp setting offers. They’re able to be filled in by the user.

    Thus something that matches up with what you’re seeking like what Mailchimp has, will need to be a custom solution at the moment, so determining how to best implement, in the most user-friendly way, is the next question.

    Thread Starter 63N

    (@63n)

    Ok, thanks. The site is running a custom child-theme and some custom plugins, so we are quite comfortable with that.

    Looking forward to seeing what you come up with!

    Plugin Author Constant Contact

    (@constantcontact)

    Before I go too far down a rabbit hole for snippets/sample code to try and help, how comfortable are you potentially with implementing things to match your forms and whatnot? Are you code savvy on some level? or is that not your forte?

    Thread Starter 63N

    (@63n)

    Yeah, as mentioned previously we are running a custom child theme, custom plugins, functions, etc. So I’m sure we can work something out to accommodate any custom code.

    Plugin Author Constant Contact

    (@constantcontact)

    Working with what I can here with how we presently have the plugin, so bear with me.

    This has been tested on a dev install, and has been working thus far. It is javascript as well.

    <script>
    jQuery('.ctct-form-5 [id*="custom___"]').val('some value').closest('p').css({'display':'none'});
    </script>
    

    Basically we’re isolating and selecting the form, dynamically setting a value for the custom field and then visually hiding the entire wrapping paragraph as well as the input.

    You’ll want to change the .ctct-form-5 value to the matching ID of the form you’re working with. You can get that ID value in the shortcode generated, as well as the address bar when editing the form.

    You’ll also want to set the “some value” to be the custom value you’re wanting to track for that form. Should be able to be repeated for each form in question.

    Hopefully in a future version of the plugin, we can make this type of thing easier, as well as perhaps the ability to set default values for some fields, all within the editor itself.

    Thread Starter 63N

    (@63n)

    Yeah, I’m surprised that there’s no way to track which signup form is used, as this is key analytical data.

    I’ve given this a try and don’t seem to be able to get it to work.

    Is the ‘some value’ a tag? And does it have to be an existing tag in Constant Contact, or will Constant Contact create a tag based on that value?

    When you say ‘dynamically setting a value for the custom field’, do I have to add a custom field to the form? If so, should it be a ‘Custom Text Field’ or ‘Custom Text Area’?

    Plugin Author Constant Contact

    (@constantcontact)

    The “some value” spot is just where you set the value you want to be saved. Say you’re trying to track which page an incoming contact originated from, you could put “contact us” or “about” for that part. It’s just a static value.

    Yes, you’ll need to use the “custom field” dropdown to add the field to be populated with the first part I mention above. Use “Custom Text Field” in this case.

    Thread Starter 63N

    (@63n)

    So, can that custom value be used for list segmentation like tags?

    It seems as though if the custom field has a label then your snippet did not work, but when I removed the label it did.

    When inspecting the form I don’t seem to be able to see the custom field though. It looks as though it’s just hidden with CSS, so shouldn’t I be able to see it in the html?

    • This reply was modified 3 years, 9 months ago by 63N.
    • This reply was modified 3 years, 9 months ago by 63N.
    Plugin Author Constant Contact

    (@constantcontact)

    This is going to store the custom value you specify on the contact itself in constantcontact.com like shown at

    https://cloudup.com/chweNL3-y-x

    It’s not going to align with a tag or anything like that.

    The field should remain in the markup/html, as the jQuery doesn’t remove it, it just adds display:none to it so it’s visually hidden.

    Thread Starter 63N

    (@63n)

    I finally managed to get this working. Two things to note though; firstly, the field has to have a label otherwise it doesn’t appear in the form; secondly, the script has to be enqueued in the footer, rather than the head, as is the default in WordPress.

    Also, the time it takes for new signups to actually appear in the Constant Contact dashboard is painfully slow!

    Plugin Author Constant Contact

    (@constantcontact)

    Good point on the footer part, at least with the parts I presented. I believe it should be fine if done in the header, but it needs to be wrapped in the commonly seen jQuery(document).ready() code as demo’d at https://learn.jquery.com/using-jquery-core/document-ready/

    Sorry for my misstep with that part.

    I believe the label gets included in what’s not shown in the end, if I recall right, by the hiding of the parent paragraph tag.

    Not sure what may be up with the slowness for the list addition, as this shouldn’t have any effect on that part. Only thing I can think of is that you may not have disabled one of the settings we have where it doesn’t send the request instantly. There should be a “Disable Cron Sending” or similarly worded option to check in the admin, to have those request go right away.

    Thread Starter 63N

    (@63n)

    Right, I did wonder about using jQuery(document).ready(). I’ve updated it to use that now.

    Yeah sorry, I didn’t mean to imply that this would affect its speed. Constant Contact has always been extremely slow, taking hours for signups to appear in the dashboard. I’ve had to resort to leaving it for a day before I come back to check. I have checked that option to disable cron sending now though, so that might shave a minute off the 24-hour wait!

    Plugin Author Constant Contact

    (@constantcontact)

    Gotcha and understood regarding this custom code being slow/slowed vs various aspects of other parts of our services.

    Hopefully this proves to be quite swift indeed.

    Let us know if you need anything else.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Add tag to contact on signup form’ is closed to new replies.