Placing customized tags (item conversion measurement)

By placing customized tags even when coordinating with GTM, you can measure item conversion.

This section explains how to send favorites list information from sites that use CODE Marketing cloud to GTM and how to send applicable data from GTM to CODE Marketing cloud.

1. Send measured data to GTM

1-1. Determine the page you want to measure and the information to measure

Make sure the page where you want to place customized tags is only a page where you want to measure various information.

1-2. Send measured information from the applicable page to GTM

In the page determined in 1-1, insert the following type of tag snippets in the location where you want to measure data.

<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
 'event': "track:itemConversionEvent",
 'code-mc.itemConversionEvents': [
   {
     "itemId": "00001",
     "conversionType": "Entry",
     "itemCount": 1,
     "itemPrice": 1050,
     "sku": "SKU1"
   },
   {
     "itemId": "00002",
     "conversionType": "Entry",
     "itemCount": 1,
     "itemPrice": 1050,
     "sku": "SKU1"
   },
 ]
});	});
});
</script>
  • The event variable is used for recognizing custom events in GTM, so it is not possible to change the variable name event.
  • The code-mc.itemConversionEvents are variables used when sending data from GTM to CODE Marketing cloud. Because the values set in each variable for the above tag snippets are samples, so they should be changed as appropriate. Also, make sure to place tags in locations where each value can be accurately referred to so that CODE Marketing cloud can operate correctly.

※ Note that dataLayer is an object available in GTM and is used to hand over information to GTM. For dataLayer details, see the following webpage.。

The data layer - Tag Manager Help

2. Send applicable data from GTM to CODE Marketing cloud

2-1. Register the dataLayer variable to GTM

Register the variable set in “1-2. Send measured information from the applicable page to GTM” to GTM.

2-1-1. From “Variables” in the menu, click “User-defined variables” > “New”

変数

ユーザー定義変数

2-1-2. For the variable type, select “Page variables” > “Data layer variables”

データーレイヤーの変数

2-1-3. In the data layer variable name, write each variable set in “1-2. Send measured information from the applicable page to GTM”

  • code-mc.itemConversionEvents

2-1-4. Click Save

データーレイヤーの変数

2-2. Create a trigger

2-2-1. From “Trigger” in the menu, click “New”

新規トリガー

2-2-2. In trigger type “Other”, select “Custom event”

カスタムイベント トリガー

2-2-3. In the trigger occurrence location, select “All custom events”

2-2-4. In the trigger event name, enter the value set in the event variable in “1-2. Send measured information from the applicable page to GTM”](#1-2-send-measured-information-from-the-applicable-page-to-gtm)

When entered exactly as indicated in the samples on this page, enter track:itemConversionEvent

2-2-5. Click “Save”

トリガーの保存

2-3. Placing customized tags for sending data to CODE Marketing cloud

2-3-1. In “Select tag type”, select “Custom HTML tag”

2-3-2. Write “Customized tag” in the “Tag settings” > “HTML” input field

Refer to the following samples and help pages of each customized tag for information you want to measurewhen writing.

  • {{code-mc.itemConversionEvents}} handle the variable names set in2-1-3.Take note that the description must contain {{}}
<script>
(function(){
  var data = {status : {{code-mc.status}}};
  if({{code-mc.itemConversionEvents}}) {
    _cc('track', 'itemCv', {{code-mc.itemConversionEvents}});
  }
})()
</script>

HTML入力

2-3-3. In “Distribution timing”, specify the trigger created in “2-2. Create a trigger”

2-3-4. Click “Save”

2-4. “Publish” changes

Publishing applies changes to your website for the first time.

変更を公開

Reference: Customized tags (item conversion measurement)