Custom Code

New Member
2 0 0

I am integrating a sales funnel using Active Campaign and we are trying to track when a customer makes purchase in my store.  Active Campaign provided this code to be added to the footer section of my store but I can't seem to find the right place to add it.

 

<script type="text/javascript">
(function(e,t,o,n,p,r,i){e.visitorGlobalObjectAlias=n;e[e.visitorGlobalObjectAlias]=e[e.visitorGlobalObjectAlias]||function(){(e[e.visitorGlobalObjectAlias].q=e[e.visitorGlobalObjectAlias].q||[]).push(arguments)};e[e.visitorGlobalObjectAlias].l=(new Date).getTime();r=t.createElement("script");r.src=o;r.async=true;i=t.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)})(window,document,"https://diffuser-cdn.app-us1.com/diffuser/diffuser.js","vgo");
vgo('setAccount', '475573227');
vgo('setTrackByDefault', true);

vgo('process');

0 Likes
Highlighted
Shopify Partner
236 59 70

Hi @Burke,

 

Welcome to the Shopify Community!

 

I understand that you need to add an Active Campaign script to the footer section of your store. I may be able to help you with this.

 

Before you customize your theme:

  • Duplicate your theme to create a backup copy. This makes it easy to discard your changes and start again if you need to.

 

How to add the Active Campaign script to Shopify:

  1. From your Shopify admin, go to Online Store > Themes.
  2. Click Actions > Edit code.
    • The code editor shows a directory of theme files on the left, and a space to view and edit the files on the right.
    • When you click a file in the directory on the left, it opens in the code editor.
  3. Click the theme.liquid file in the Layout folder.
  4. Find this code, towards the bottom of the file:
    </body>
    Note: Towards the top of the file there is a <body> tag without a slash "/" which is not the one you're looking for. Keep in mind that you're looking for </body> with a slash "/" towards the bottom of the file.
  5. Add the Active Campaign code just above the </body> tag, for example:
    <script type="text/javascript">
    (function(e,t,o,n,p,r,i){e.visitorGlobalObjectAlias=n;e[e.visitorGlobalObjectAlias]=e[e.visitorGlobalObjectAlias]||function(){(e[e.visitorGlobalObjectAlias].q=e[e.visitorGlobalObjectAlias].q||[]).push(arguments)};e[e.visitorGlobalObjectAlias].l=(new Date).getTime();r=t.createElement("script");r.src=o;r.async=true;i=t.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)})(window,document,"https://diffuser-cdn.app-us1.com/diffuser/diffuser.js","vgo");
    vgo('setAccount', '475573227');
    vgo('setTrackByDefault', true);
    vgo('process');
    </script>
    </body>
  6. Click Save.

 

Let me know if this solves your problem or if you need further help!

Brian | Shopify Partner | Ecommerce Consultant
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution  
 - Need further assistance? Visit www.BrianAtWork.com

0 Likes
New Member
2 0 0
Hi Brian,

Thanks for the info. Unfortunately I didn’t get the result I was hoping for.

I was expecting an event would have been added to Active Campaign existing contact record after I purchased an item from my store using a test product.

Here’s the Theme.Liquid code:






<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

{% if settings.favicon %}

{% endif %}


<br> {{ page_title }}{% if current_tags %}{% assign meta_tags = current_tags | join: ', ' %} – {{ 'general.meta.tags' | t: tags: meta_tags }}{% endif %}{% if current_page != 1 %} – {{ 'general.meta.page' | t: page: current_page }}{% endif %}{% unless page_title contains shop.name %} – {{ shop.name }}{% endunless %}<br>

{% if page_description %}
<meta name="description" content="{{ page_description | escape }}" />
{% endif %}


{% include 'social-meta-tags' %}



<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="theme-color" content="{{ settings.color_primary }}" />


{{ 'timber.scss.css' | asset_url | stylesheet_tag }}
{{ 'theme.scss.css' | asset_url | stylesheet_tag }}




{{ content_for_header }}

{{ 'jquery-2.2.3.min.js' | asset_url | script_tag }}



{% comment %}
If you store has customer accounts disabled, you can remove the following JS file
{% endcomment %}
{% if template.directory == 'customers' %}
{{ 'shopify_common.js' | shopify_asset_url | script_tag }}
{% endif %}





{% section 'header' %}




{{ content_for_layout }}




{% section 'footer' %}

{%- if template.name == 'index' -%}


{{- 'home_page.slideshow.navigation_instructions' | t -}}


{%- endif -%}

{% if template.name == 'product' or template.name == 'index' %}
{{ 'option_selection.js' | shopify_asset_url | script_tag }}
{% endif %}


  • {{ 'general.accessibility.refresh_page' | t }}



{{ 'theme.js' | asset_url | script_tag }}









0 Likes
Shopify Partner
236 59 70

Hi @Burke,

 

The instructions I gave you were correct. However, I can see that in your first post, you are missing code from the Active Campaign script. For example, the </script> tag is missing.

 

You're also missing code from the theme.liquid file that you posted.

 

If you will post the entire script from ActiveCampaign, and also post the entire contents of the theme.liquid file – then I will help you make the correct changes.

 

Cheers!

Brian | Shopify Partner | Ecommerce Consultant
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution  
 - Need further assistance? Visit www.BrianAtWork.com

0 Likes