Way to run offer JS function when conversion is made? | Community
Skip to main content
February 2, 2016
Solved

Way to run offer JS function when conversion is made?

  • February 2, 2016
  • 1 reply
  • 1474 views

Hi there,

I have a test that I'm trying to write where I need to take the last value of a variable before a conversion is made and pass it on to the server. Since I need the last value (and ONLY the last value), I need the javascript function in the offer code to run once the conversion has been made to ensure accuracy of results. Is there a way to invoke an offer's function right after a conversion is made?

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JonTehero

Hi Genevieve,

I have a few follow-up questions about what you are trying to accomplish, but perhaps I can provide a few different answers to possible scenarios.

Updating the Profile

If you are hoping to store the variable with the user's profile, this can be accomplished "profile scripts."  Profile scripts allow you to apply logic on top of any call to our system (see documentation here) and store the value within the user's profile. Example use-case: every time a customer purchases, increment their total_dollars_spent value within their profile.

The logic you will want to apply is to save a particular value when the conversion event fires. A conversion event can be identified looking for any call with one of the following parameters: orderId, orderTotal, or productPurchasedId (see documentation here).

Writing a dynamic values in your offer

You can pass information about the activity, the experience, the user's profile, and more by following the instructions here. This would allow you to (1) register the conversion, (2) run JS logic on the conversion event and write a value to the user's profile, (3) return a value from the activity, the experience, or the user's profile directly to the page (or server).

Hopefully that helps.

1 reply

JonTeheroAdobe EmployeeAccepted solution
Adobe Employee
February 2, 2016

Hi Genevieve,

I have a few follow-up questions about what you are trying to accomplish, but perhaps I can provide a few different answers to possible scenarios.

Updating the Profile

If you are hoping to store the variable with the user's profile, this can be accomplished "profile scripts."  Profile scripts allow you to apply logic on top of any call to our system (see documentation here) and store the value within the user's profile. Example use-case: every time a customer purchases, increment their total_dollars_spent value within their profile.

The logic you will want to apply is to save a particular value when the conversion event fires. A conversion event can be identified looking for any call with one of the following parameters: orderId, orderTotal, or productPurchasedId (see documentation here).

Writing a dynamic values in your offer

You can pass information about the activity, the experience, the user's profile, and more by following the instructions here. This would allow you to (1) register the conversion, (2) run JS logic on the conversion event and write a value to the user's profile, (3) return a value from the activity, the experience, or the user's profile directly to the page (or server).

Hopefully that helps.