Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classify events separatly #116

Open
hashiranwaar opened this issue Nov 11, 2020 · 4 comments
Open

Classify events separatly #116

hashiranwaar opened this issue Nov 11, 2020 · 4 comments

Comments

@hashiranwaar
Copy link

Everything fine, Thanks for Pixel.

One thing i need to ask, Is there any easy way to make pixel work like
opix.track('event', 'reservation', {'key' : 'value'})
to track the events

and opix.user.setEmail('email', '[email protected]') to set or update user's profile data.

Means, If we have that sort of function it will be easy to call API on basis of function called.

Thanks

@stuyam
Copy link
Contributor

stuyam commented Nov 12, 2020

Hi there 👋 what are you looking to accomplish here? Are you trying to set default data that will be sent on every event trigger or something? Some more detail would be great 👍

@hashiranwaar
Copy link
Author

@stuyam , the Pixel send all event generally as same ...like if user is passing login event or register event or product viewed event...all events are coming at same place.

What i am looking for is,

if we can make classes or methods in pixel for different purposes.

I mean , if we want to track user events ...we can use a class like opix.track('event_name', {EVENT_DATA}) so this function will send event data to DATA INSERT API https://api.example.com/events

And for user related events e.g if user login, register or update his email/mobile number , we can call class like
opix.user.setAttributes('Email', '[email protected]') , OR opix.user.login('USER_ID_HERE') so this method will directly send data to user profile update API like https://api.example.com/users

Hope you got my point....If need more detail... i will explain..

Thanks @stuyam 👍

@stuyam
Copy link
Contributor

stuyam commented Nov 12, 2020

Ok so what it sounds like you want is the ability to send event data to different urls rather than only supporting one? So being able to send some events to https://api.example.com/events and some to https://api.example.com/users?

It seems like you are trying to use open pixel like ajax to send updates to your backend? Im not sure open pixel is an ideal candidate for something like that. Why couldn't you use ajax or fetch for making updates to a user in this case?

@hashiranwaar
Copy link
Author

I made a switch Case with event name so i can change API endpoint according to event type .. :)

switch (this.event){
  case 'login':
     this.api_url = 'https://api.example.com/user_login'
     break;
  .
  .
  .
  default:
    this.api_url = 'https://api.example.com/postEvent'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants