Retargeting codes
Setup instruction
1. Setting code on website
Using various codes for various types of webpages allows to identify interests of various user segments correctly and to create individual recommendations for each client depending on his interests and behaviour on website.
From architectual perspective we have developed everything conveniently. All codes are asynchronous and will be deleted automatically after executing. It is required to set them up on pages inside the tag.
Main page pageType=1
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 1});
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var
a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
View a product pageType=2
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 2});
var ad_product = {
"id": "1234", //product id
"size": "XL" //product size
};
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
View page of pageType=3 category
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 3});
var ad_category = "1234"; //category id
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
View basket containing one product pageType=4
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 4});
var ad_products = [
{
"id": "123", //product id
"number": "1" //quantity of this product
}
];
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
View basket containing 2+ products pageType=4
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 4});
var ad_products = [
{
"id": "123", //product id
”number": "2" //quantity of this product
},
{
"id": "123", //product id
”number": "2" //quantity of this product
}
];
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
Order a product pageType=5
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 5});
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
Complete order pageType=6
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 6});
var ad_order = "1234"; //order id
var ad_amount = "9999"; //sum of an order
var ad_products = [
{
"id": "123", //product id
"number": "2" //quantity of this product
},
{
"id": "234", //product id
"number": "1" //quantity of this product
}
];
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
Quick product view pageType=7
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 7});
var ad_product = {
"id": "1234" //product id
};
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
Put 1 product to the basket pageType=8
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 8});
var ad_products = [
{
"id": "123", //product id
"number": "1" //quantity of this product
}
];
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
Put 2+ products to the basket pageType=8
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 8}); var
ad_products = [
{
"id": "123", //product id
"number": "1" //quantity of this product
},
{
"id": "234", //product id
"number": "5" //quantity of this product
}
];
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
Remove 1 product from the basket pageType=9
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 9});
var ad_products = [
{
"id": "123", //product id
"number": "1" //quantity of this product
}
];
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
Remove 2+ products from the basket pageType=9
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 9});
var ad_products = [
{
"id": "123", //product id
"number": "1" //quantity of this product
},
{
"id": "234", //product id
"number": "5" //quantity of this product
}
];
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
Put a product aside pageType=20
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 20});
var ad_product = "1234"; //product id
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
Send a lead pageType=30
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 30});
var ad_order = "1234"; //order id
var ad_amount = "9999"; //sum of an order
var ad_payment = "999"; //sum to be paid by partner or source
var ad_company = "mediasniper "; //name of partner or source to whom the lead will be assigned
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
Other pages pageType=0
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 0});
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
2. Setting retargeting codes via Google Tag Manager
What is Google Tag Manager
Google Tag Manager (GTM) is a service that allows marketing managers and analysts to manage tracking codes on website without developers.
To connect and configure external services, you must place special tags or pieces of JavaScript code on the website. To configure tracking codes you need developers, it can be resulted in:
- delay in starting ad campaign (if developers are busy and do not have enough free time);
- slow page loading (especially, when there are many codes);
- errors while data collecting (if invalid code was entered).
GTM allows to place universal code (dataLayer) and add, delete and edit various tags in GTM interface without developers after placing.
It allows marketing managers and webmasters to сorrect current campaign settings quickly and independently.
Set code in GTM
To start using Google Tag Manager follow these steps:
- go to the page google.com/tagmanager?hl=ru and create a new account (or log in if you are already registered);
- create container for your website;
- place your container code snippets on website and delete all other tags.
Now you can add tags (e.g. tag for tracking AdWords or Google Analytics conversions) to your website via Google Tag Manager interface.
Create account
A Tag Manager account represents the topmost level of organization. Typically, only one account is needed per company, it allows to manage tags of all its websites.
If you have one Google account, you can create several Google Tag Manager accounts and manage them. It is very convenient if you are working with several campaigns and websites of several companies.
When you open Google Tag Manager you see the list of this service accounts you have access.
- Click New account on "All accounts" page in Google Tag Manager.
- Enter an account name and click Continue.
- Follow guidelines in "Create container" section.
Create container
When creating account in Google Tag Manager you need to create container. It contains all the tags of a website, therefore it is recommended to name it appropriately. For example, container for the website example.com can be named as "example".
If you start to manage tags on a new website, create for it a container. Please follow these steps to create a new container:
- Select account in Google Tag Manager. "Container" page appears.
- Click New container.
- Enter a name, select "Webpages" in the "Where container will be used" section and click Save. If a container is created together with an account, select Create account and container.
Place container snippet
After you create container, you get a code snippet. Copy this code and paste it into each webpage after opening tag. Do not forget to delete other tags (e.g., Google Analytics tags or AdWords conversion tracking tags).
Please follow these steps to get the container snippet.
- Select account in Google Tag Mananger. "Containers" pages will appear.
- Select container from the list.
- On the navigation menu left please select Users and Settings > Settings.
- To make sure you pasted code correctly, use the Tag Assistant Chrome extension.
Add, update and publish tags
Your first created container will be empty, therefore it is required to add tags. First, place tags to this container, that you have removed from the website on the previous step. For example, if you have removed AdWords conversion tracking tag, add it to the Google Tag Manager. After creating container and placing container tag on the website, you are ready to add and update all tags on the "Tags" page.
- Select account in Google Tag Manager. "Containers" page will appear.
- Select neccesary container from the list. "Tags" page will appear.
To add a tag:
Click Create > Tag. Choose tag type, e.g. Google Analytics, and specify tag firing options.
To edit a tag (for example, update tag firing options): Click a tag in the list and make changes on the "Edit Tag" page
To delete a tag:
Select tag from the list. Click a tag in the list. On the "Edit Tag" page, choose Delete.
Preview website.
Preview mode gives you an opportunity to inspect your Tag Manager configuration on your site to make sure everything behaves as expected. On the web, you can use the debug option to see which tags fire as you browse and interact with the site.
On any page of the section Container draft select Create a version from the navigation menu, then click *Preview > Preview and debug.
Publish changes on the website.
Select Versions > General info on the navigation menu left. Choose a version saved while website preview in the table. Click Publish.
We recommend you to publish the version that you have previewed. But you can create and publish versions without preview. Click Create a version on the "Tags" page, then click Publish.
Example of setting a Google Tag Manager code
Set the following code as the example:
<script type="text/javascript">
window.ad_retag = window.ad_retag || [];
window.ad_retag.push({level: 5});
(function () {
var s=document.createElement("script");
s.async=true;
s.src=(document.location.protocol=="https:"?"https:":"http:")+"//static.bumlam.com/engine/rcmd4.js";
var a=document.getElementsByTagName("script")[0]
a.parentNode.insertBefore(s, a);
})();
</script>
In the Tag name field enter the name of a new tag. As for Tag type, choose Custom HTML tag. After that, you will see HTML field, enter the code to this filed (see Figure 1).
After you filled in all the fields for a new tag, you can proceed to Tag firing options (in the upper right corner).
Proceed to creating triggers for a tag. Select Create a new tag firing options. Fill in the Optionname and condition fields. Figure 3 shows the example.
Example shows Order code.
If we assume that http://site.ru/cart/order is an order page, we specify that the code must respond to url that ends as follows: /cart/order.
Example for Main page code pageType=1:
We see that if the condition is fulfilled, user visits the main page. In this case code will respond as follows pageType=1.
After that click Save and see the tag firing options in the list:
Then click Save and see the tag in the list of tags with specified type and tag firing option:
After creating all tags for the website, create a Version.
You can have several your code versions. To run everything successfull, publish the required version.
3. Product feed. Format.
Product catalogue or feed is a list of products to be advertised.
Each product in the list has its attributes used for ad generating: product id, name, description, format, price etc.
We use product catalogue format - YML (Yandex Market Language) developed by Yandex and based on XML standard.
Requirements for YML-file
- It is forbidden in YML to use non-printing characters with ASCII-codes 0-31 (excluding characters with codes 9, 10, 13 — tabs, line feed, carriage return).
- Characters " & > < ' must be replaced for equivalent codes:
Please note
You can use characters " & > < ' in CDATA while offer description.
- Acceptable encoding of YML-file: UTF-8, windows-1251.
Example of YML-file
<?xml version="1.0" encoding="UTF-8"?>
<yml_catalog date="2017-02-05 17:22">
<shop>
<name>BestSeller</name>
<company>Tne Best inc.</company>
<url>http://best.seller.ru</url>
<currencies>
<currency id="RUR" rate="1"/>
<currency id="USD" rate="60"/>
</currencies>
<categories>
<category id="1">Бытовая техника</category>
<category id="10" parentId="1">Small kitchen appliances</category>
<category id="101" parentId="10">Sandwich makers and baking tools</category>
<category id="102" parentId="10">Ice cream makers</category>
</categories>
<offers>
<offer id="12346" available="true" bid="80" cbid="90" fee="325">
<url>http://best.seller.ru/product_page.asp?pid=12348</url>
<price>1490</price>
<oldprice>1620</oldprice>
<currencyId>RUR</currencyId>
<categoryId>101</categoryId>
<picture>http://best.seller.ru/img/large_12348.jpg</picture>
<store>false</store>
<pickup>true</pickup>
<delivery>true</delivery>
<delivery-options>
<option cost="300" days="0" order-before="12"/>
</delivery-options>
<name>Waffle maker First FA-5300</name>
<vendor>First</vendor>
<vendorCode>A1234567B</vendorCode>
<description>
<![CDATA[
<p>Excellent gift for Viennese waffles fans.</p>
]]>
</description>
<sales_notes>Prepayment needed.</sales_notes>
<manufacturer_warranty>true</manufacturer_warranty>
<country_of_origin>Russia</country_of_origin>
<barcode>0156789012</barcode>
<cpa>1</cpa>
<rec>123,456</rec>
</offer>
<offer id="9012" type="vendor.model" available="true" bid="80" cbid="90" fee="325">
<url>http://best.seller.ru/product_page.asp?pid=12345</url>
<price>8990</price>
<oldprice>9900</oldprice>
<currencyId>RUR</currencyId>
<categoryId>102</categoryId>
<picture>http://best.seller.ru/img/model_12345.jpg</picture>
<store>false</store>
<pickup>false</pickup>
<delivery>true</delivery>
<delivery-options>
<option cost="300" days="1" order-before="18"/>
</delivery-options>
<outlets>
<outlet id="1" instock="50"/>
<outlet id="2" instock="20"/>
</outlets>
<typePrefix>Ice cream maker</typePrefix>
<vendor>Brand</vendor>
<model>3811</model>
<description>
<![CDATA[
<h3>Ice cream maker Brand 3811</h3>
<p> This appliance will be of great interest for all lovers of desserts and sweets, it allows you to make delicious homemade ice cream made from natural ingredients.</p>
]]>
</description>
<param name="Colour">white</param>
<sales_notes>Prepayment needed .</sales_notes>
<manufacturer_warranty>true</manufacturer_warranty>
<country_of_origin>China</country_of_origin>
<barcode>0123456789379</barcode>
<cpa>1</cpa>
<rec>345,678</rec>
</offer>
</offers>
</shop>
</yml_catalog>
Element description
Element | Description |
---|---|
xml header | Standard XML-title. It must begin with the first string, with null character. |
yml_catalog | Each XML-document can contain only one core element. YML format uses <yml_catalog> as a core element. Attribute of date element <yml_catalog> must correspond to the date and time of generating a YML-file on the shop side. Date must be specified in the following format YYYY-MM-DD hh:mm. |
shop | Element contains description of shop and its products. Obligatory element. |
name | Short shop name, max 20 characters. The name must not contain words not related to the shop name, e.g. «best», «cheap», phone number etc. Obligatory element. |
company | Full name of the company that owns the shop. It is not published, used for internal issues only. Obligatory element. |
url | URL of the shop home page. Max 50 words. Cyrillic links are allowed. |
platform | The system of managing content that is a basis for the shop working (CMS). Not obligatory element. |
version | CMS version. Not obligatory element. |
agency | Name of the agency providing technical support and responsible for website. Not obligatory element. |
Contact address of CMS developers or agency providing technical support. Not obligatory element. | |
currencies | List of shop currency rates. Obligatory element. |
categories | List of shop categories. Obligatory element. |
delivery-options | Price and terms of courier delivery worldwide. Obligatory element, if all data concerning delivery are specified in the price list. |
cpa | Element manages product offers in the program «Order on Market». Not obligatory element. |
offers | List of shop offers. Each offer is described in the Offer element. Obligatory element. |
Updated about 3 years ago