Best answer

How do I add this JavaScript code to Zapier, to issue a 3rd party gift?

  • 17 September 2020
  • 4 replies

Userlevel 1

Hi.  My eCommerce website needs to run JavaScript code so a 3rd party can send the customer a gift. The JavaScript code worked on the Thank You page, but I need to have a few-day delay before the script runs, so I'm trying to do this with Zapier instead. But Zapier is giving the following error when the same code is used there:

The run javascript could not be sent to Code by Zapier. SyntaxError: Unexpected token <

Zapier Support could not help, and I couldn't find the solution in Zapier's documentation.

Can someone please help modify the short code below, so that it can be run by Zapier?

<script src=""></script>
window.onload = function(){
var fdDE_detail = {
"fbDE_message":'Thank you for your purchase!'

The variables CustName, CustEmail, and VoucherValue are from prior Zapier steps. The first 2 need to be within single quotes, and the third is an integer (not requiring quotes). Please see image below:


Does anyone know how to fix the above error (in bold) so this code runs?

Appreciate your help! Thanks.


Best answer by steph.n 7 December 2020, 17:36

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 7
Badge +8

Hi @SamK ,

Thanks for reaching out!

Tagging in @ikbelkirasan to see if they can assist here. @ikbelkirasan any ideas? 

Userlevel 1

Hi @Liz_Roberts ,

Thanks for the follow-up.

We can close this, as I came across a somewhat-hidden Zapier integration which solves the problem.



Userlevel 7
Badge +12

@SamK Are you able to share which integration you used in case someone else is looking to do the same thing? Thanks!

Userlevel 7
Badge +8

Hello Sam,

It looks like Nikki from our Support team responded back to you:

Based on my testing of Zapier so far, it doesn't seem like Zapier would have the updated Shopify data for the customer. It seems like in 7 days it would still be using the initial data, which excludes new tags (which identify next steps taken by the customer). If that's the case (please confirm), kindly let me know: How can Zapier make use of the updated data for that specific customer?

You have the right idea here. Zapier WOULD run on the data initially found from say, the "New Customer" or "New Order" trigger if you used a Delay by Zapier step.

However, following a 7 day delay, you could go on to use a "Find Customer" step, which would look up the current state of the customer, including what tags they have currently. So, it is indeed possible to get that updated data, using a "Find" step.

Can you please help modify the short code above so that it can be run by Zapier?

Our Code app is an advanced feature, and I’m afraid we aren’t able to help you create or debug your code through our support channel. I’m very sorry about that!

We do have some resources in our help section:

The best place to ask for help with your code is Just tag your question with a “Zapier” tag and usually there will be folks who’d be willing to help you out. You can see all the questions that have already been asked here:

I hope this helps answer your questions, but please let me know If there's anything that's unclear or you've got something else you'd like to run by me. I'm here to help!