How do I add the tracking JavaScript code to my website?

Keep the following information in mind when you’re installing the JavaScript code snippet:

  • You copy the JavaScript code snippet in your GetResponse account. The snippet is always available for copying when you select Properties of the Purchase, Abandoned cart, and Visited URL conditions.
  • You need administrative rights to be able to access your page source code.
  • Make sure to insert the snippet into each page where you’d like to track visitors.
  • Add the snippet directly into the HTML source code. If you’re using a site engine, insert the code into your website’s management system.
  • (Optional) Use the gaSetUserId method to properly identify your visitors who haven’t come to your website via a GetResponse message link. It requires passing on a user email as a parameter to GetResponse.

Where do I get the JavaScript code snippet?

1. Go to Menu>>Automation and select Create workflow. Choose a condition to start building a workflow.
2. Drag and drop the ecommerce element you want to use into the workspace.
3. The Install JavaScript Code pop-up window opens.
4. Click COPY CODE.

JavaScript code snippet.

The snippet is copied to the clipboard. Now you need to you add the snippet to your website’s management system or insert it directly into the HTML source code.

Where do I insert the JavaScript code snippet?

If you can edit your HTML source directly, you simply copy/paste the JavaScript code into the page code.

JavaScript code snippet in a page.

Note: Our snippet needs to be the last element in the the section. Don’t put any tags between the closing tag of our snippet and the closing tag.

If you’re using a site engine, refer to your site engine documentation on how to add JavaScript code to pages.

Do I need to add the JavaScript code multiple times for different workflows?

You don’t have to add the JavaScript code snippet multiple times for your site each time you create a new workflow. Once you post the code on your site the first time, it will continue to track all future workflows.

When do I need to use the “gaSetUserId” method?

The gaSetUserId method is a way to properly identify your visitors who haven’t come to your website via a GetResponse message link. It requires a visitor email to be passed on to GetResponse as a parameter.

If you direct people to your pages using message links in your newsletters, the JavaScript code snippet you pasted into your page source code identifies them automatically.

If your visitors come from other websites where they leave their email address—for example, form submission pages, newsletter sign-ups, registrations, logins, purchase page details, etc.— you need to:

1. Add the JavaScript code snippet to your website where you’d like to track visitors (to get it, follow the steps we describe in “How do I get the JavaCode snippet).
2. Add additional JavaScript code to pages where your customers leave their emails.

For example, for PHP-generated pages add

<?php echo ” gaSetUserId(‘”.$userEmail.”‘);”; ?>

3. Make sure that appropriate forms pass the user’s email address in the $userEmail parameter (for PHP-generated pages). This means that you need to write additional lines of code that pass a customer email address as a $userEmail parameter. Note: This step requires advanced coding skills. Consider sending the code to your webmaster.

We’ll be adding more coding examples, so stay tuned.

Can I send the code to my website developer?

You can send the JavaScript code snippet to your developer.

1. Go to the element Properties to open the Install JavaScript code
2. In the bottom left corner, click the Send the code to your developer link to open a form.
3. Use a drop-down list to select your email address. Then, enter your designer’s email and an optional message. If you change your mind, or you’d like to return to the code, click I’ll paste the code myself.
4. Click Send message.

Once you do this, your developer receives an email that lets him or her know that you’ve created an automation workflow that requires JavaScript installation. They receive the snippet and an additional piece of code. This extra code helps track your visitors who don’t use a GetResponse message link to get to your website.