Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi -
Is it possible to auto-update a customer tag or metafield whenever someone hits a landing page?
Ultimately, I want to create automatic customer segments for prospects who come in through a certain landing page. With those customer segments, I plan on creating discounts that only work for that segment.
Is there a Javascript snippet, or some alternative that would help me arrive at this goal?
Thanks!
Hey there!
I am not aware of any way directly in Shopify to do this without making calls to their backend API - maybe somebody else will be able to jump in with a native solution.
However, this is something that can be done using our Customer Fields app and the Javascript API that we provide. You can check out more in our API docs here: https://developers.customerfields.com/front-end-api/customer-api/customer-tags/
I noticed your application summary primary mentions customer forms. Does this solution requires a customer form, or is there a way to create updates these tags for someone who simply hits the page?
Best,
Al
Hey @nafea_al,
The primary function of the Helium Customer Fields app is creating custom forms for registering and editing customer accounts.
However, even if you don't use a custom form, you could still use our JS API to programmatically update customer metafields or tags.
What would that look like? Would I need to know how to code to be able to use the JS API?
Hey @nafea_al, this would definitely require some familiarity with coding, and specifically with Javascript. If you are not comfortable in directly editing theme code, you will probably want to work with a Shopify expert to implement this for you.
Tags caveat: Always remember to know what system you are using, REST api can easily wipe out all other tags when you "create" a new tag, graphiql is a bit better but still test that original tags are preserved.
Hi
@nafea_al wrote:Is it possible to auto-update a customer tag or metafield whenever someone hits a landing page?
I'd suggest opening a support ticket for feature requests, not being able to update customer tags through the themes is a long standing problem.
Even now unfortunately there is no customer-updated flow trigger which would simplify this, as then we could possibly get events when the customer address is updated through the themes account management pages.
Currently you'd only be able to do this on an initial customer registration, or in a contact form.
After that for existing customers you need an app to do any such backend work that is not directly related an order.
If this can be done as part of an order you'd just put a cart attribute through and check for it in a shopify-flow automation triggered by order creation.
Apps like helium can simplify it, there's also more utility apps like usemechanic to script together such automations.
https://tasks.mechanic.dev/tutorial-trigger-a-task-from-a-contact-form-using-webhooks
Theoretically this could be done in shopify natively using flow's scheduled-time trigger then get-customer-data action to check if there's some special text in the address data you've inserted from the front end using customer forms using javascript.
But there's a lot of legwork there just to get to working concept, and keep in mind there is no edit customer data action in shopify-flow therefore this would be multi multi step process so that the next time the customer visits there something that removes the excess hidden data in the address fields after the tag/metafield is created.
Bleh 🤮.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
We do already store cart attributes when someone comes in through a the link. Are you saying that we can make a discount code work only if that cart attribute exists on someones cart?
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025