Little JS help please! (With flows)

Hey all,

I’d really appreciate the guidance of any JS guru’s in here.

We use Segment.com and I want to start setting up our identify and track calls.

I have the Segment tracking snippet correctly installed, and we are currently sending page visit data.

What I now need to figure out is how to fire JS events with dynamic data, such as an identify call.

An identify call is a JS event that triggers the Segment Snippet and will fire for example when someone logs in. This is an example from the Segment website of a basic identify call.

analytics.identify("97980cfea0067", {
  name: "Peter Gibbons",
  email: "peter@example.com",
  plan: "premium",
  logins: 5
});

With data bindings it would look something like:

analytics.identify(' {{user.id}} ', {
  name: '{{user.fullname}}',
  email: '{{user.email}}'
});

If I input the above call into a static event onclick - it fires perfectly and sends the data through to Segment. But I need to use dynamic data, so have been trying to get this working with flows but I just don’t have enough JS experience to figure it out.

Any nudges in the right direction so I can then learn and take it from there would be hugely appreciated!

Community Page
Last updated: