Open JulieVoltaire opened 3 years ago
I am facing the same issue. @JulieVoltaire Did you find a fix for this?
I'm new here, but this looks like a backend API. Are you trying to use it from the front-end? If so, this is the error I would expect.
anyone got a solution to making calls to the api from client-side?
Same error here. Trying to use the JavaScript SDK as per this documentation article: https://www.activecampaign.com/blog/how-to-setup-activecampaign-event-tracking#events-to-ac-using-js
@dionkas, @CP-4, @JulieVoltaire Since the ActiveCampaign API requires that a secret key is sent in a header, you'd be exposing your secret key to all of your visitors if you made requests to the ActiveCampaign API from the client side. Anyone with this key can make a request to ActiveCampaign on your behalf, please don't do this!
@fariazz That article doesn't describe using this SDK and shows making requests to https://trackcmp.net/event
which is not the URL format of the ActiveCampaign API that this SDK uses. The article is pretty old (2017), so perhaps references an older ActiveCampaign API or something.
Thank you for clarifying @fariazz . We ended up deciding to send the data to a Zapier webhook, and let Zapier do the ActiveCampaign integration.
I think what many of us were after was the ability to use JS to send ActiveCampaign events from the client-side, in a similar way to how we send events to say Google Analytics or Mixpanel. Yes, someone can open the browser console and send events, but this would be low-impact from the business-side, and after using Google Analytics and Mixpanel for 10 years or so I've never seen this happening.
In our case, we wanted to send product usage events to ActiveCampaign, without having to develop backend modules. Simple stuff, like whether the user invited another user, or whether a user watched a video within the platform.
@jaydiablo , so what solution do you propose to fetch data from a active campaign api without having cors issues?
I have the same problem (after following the same tutorial article above: https://www.activecampaign.com/blog/how-to-setup-activecampaign-event-tracking#events-to-ac-using-js) - I thought the whole point of posting something (e.g. like a form) was that it would be limited access (for e.g. the event ID has to match something that's already in AC), and thus safe. If anyone else finds a way to send events from the client-side to AC, I'd be very interested.
Hey, there isn't a way to call the AC api from the client-side. To bypass this, I am using a proxy on my server to forward the events from the client to AC.
Hi,
I do a GET request on my Vuejs app (localhost:8080) and have some CORS problems : "Access to fetch at 'my_url/admin/api.php?api_key=my_key&api_action=contact_view_email&api_output=json&email=julie@equitack.com' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."
I have the same problem when I use a simple fetch instead of your library.
How can I manage CORS?
Thanks for your help