0
votes

It seems like a pretty common question but I haven't found a solution that fits my needs.

I need to send out successful conversion tracking code back to google upon a successful action/event.

My workflow process is such..

A user gets to a register page with a form...

When the form submits and the user is successfully registered, they are redirected to a dashboard page.

How can I fire off the conversion form this event/goal after my API says it was a success?

Similarly, when a user makes a purchase its the same workflow.

checkout -> dashboard

Side note about purchases: I would like to have a variable conversion value for each purchase (I can send amounts out from my server)

How can I make sure that:

  1. Every time a user visits their dashboard a tracking code does not get fired out?
  2. The proper tracking code conversion is sent (register or purchase)
  3. The code is only sent upon a successful action (not on button click but on a successful return from my server)
1

1 Answers

0
votes

I think that the key is NOT to fire pixel at dashboard onload(), but fire it only after API confirm the success - for example with JavaScript promises.

Alternative to this can be using Google Tag Manager, which should be able to fire pixel only after certain rules are accomplished