Now that we've written the code to save
the food preference in the data layer,
we can create variables in tag manager
to hold the special of the day for
each kind of food preference.
First, we need to create a data layer
variable to hold the food preference.
So you go to the variable screen,
create a new variable.
And this time, it's important
to choose data layer variable.
Name the variable, this name is for
you to identify what's in the variable.
And then you configure the variable.
The only thing you can figure for
Data Layer Variable is the name of the
variable that you using in your code.
This name must exactly match
the key you set in your code.
So in my case I used the key food_pref,
so
my variable must be configured for
the variable name to be food_pref.
You can set the default
value if you like.
I'm going to set it to unrestricted.
Create the variable.
Now we have the food pref variable.
The next thing to do is to
create the daily specials for
the different food preferences.
So, the easiest way to create a new
variable is to copy an existing one.
So, I'm going to copy daily-special-en,
copy.
Make sure to rename it.
Notice that the type
is a value collection.
Configure the variable, set the value,
choose a nice vegan special of the day,
whatever sounds good to you.
Since we copied an existing variable
we've got the triggers that came with
that variable.
And we need to get rid of them.
So delete all the existing triggers and
create a new custom trigger.
Now, this list of triggers doesn't
include the trigger we want, so
we create a new one.
And it's going to be the vegan trigger.
Custom is good.
And then you want it to fire when
the food preference is vegan.
Look for the food preference contains,
or even contained, equals vegan.
Save the trigger,
create the variable, and
now we have the daily-special-vegan
to the value collection variable.
As well as the food pref which
is a data layer variable.
And don't forget to publish.
Okay, it's your turn now.
So you're going to create the food
pref variable and the trigger and
we'll start out showing
a vegan daily special.
To start with, create the food-pref
DataLayer variable and
then create a value collection
variable for the vegan daily special.
And the easiest way to
do that is to copy and
edit the daily-special-en
that already exists.
Choose a custom trigger for it and
then create and use the vegan trigger.
And what's the last step
that you mustn't forget?
Publish.
Okay, go ahead and do these things.
And then try it out on your app.
والآن أتممنا كتابة التعليمة البرمجية لحفظ
تفضيلات الطعام في طبقة البيانات،
يمكننا إنشاء متغيرات في تطبيق
Tag Manager للاحتفاظ بالطبق المميز في اليوم
لكل نوع من تفضيلات الطعام.
أولاً، يجب إنشاء متغير طبقة البيانات لحفظ
تفضيلات الطعام.
لذا يجب الانتقال إلى شاشة المتغير، ثم
إنشاء متغير جديد.
وفي هذه المرة، من الضروري اختيار
متغير لطبقة البيانات.
قم بتسمية المتغير، وهذا الاسم سيفيدك
في تحديد ما هو موجود في المتغير.
ثم يمكنك تكوين المتغير.
شيء وحيد ستقوم بتكوينه
لمتغير طبقة البيانات هو اسم المتغير
الذي تستخدمه في التعليمة البرمجية.
يجب أن يتطابق هذا الاسم تمامًا مع المفتاح
الذي أدخلته في التعليمة البرمجية.
لذا، استخدمت في حالتي المفتاح food_pref،
ولذلك
يجب تكوين المتغير الخاص بي لكي يكون اسم
المتغير هو food_pref.
يمكنك تعيين القيمة الافتراضية
إذا رغبت في ذلك.
سأجعلها غير مقيدة.
إنشاء المتغير.
والآن أنشأنا متغير
تفضيلات الطعام.
الشيء التالي الذي ينبغي عمله
هو إنشاء أطباق مميزة يومية
لتفضيلات الطعام المختلفة
لذا فإن أسهل طريقة لإنشاء متغير
جديد هي نسخ متغير موجود.
لذا، سأقوم بنسخ الطبق المميز اليومي.
تأكد من إعادة تسميته.
لاحظ أن هذا النوع هو مجموعة قيم.
قم بتكوين المتغير، وتعيين القيمة،
واختر طبقًا نباتيًا رائعًا لليوم، مهما
كان جيدًا بالنسبة إليك.
ونظرًا لأننا قمنا بنسخ متغير موجود، فقد حصلنا
على المُشغلات المصاحبة
لهذا المتغير.
ونريد التخلص منها.
لذا قم بحذف جميع المشغلات الموجودة، وأنشئ مشغلاً جديدًا مخصصًا.
والآن، لا تتضمن قائمة المشغلات هذه
المشغل الذي نريده، لذا
ننشئ مشغلاً جديدًا
ثم سيكون هو مشغل الطبق النباتي.
يعُد التخصيص شيئًا جيدًا.
ثم سترغب في التشغيل عندما يكون
تفضيل الطعام هو النباتي.
ابحث عما يتضمنه تفضيل الطعام، أو حتى
ما تضمنه إن كان يعادل "نباتيًّا".
احفظ المشغل، وأنشئ المتغير،
و
يوجد لدينا الطبق النباتي المميز اليومي
لمتغير مجموعة القيم.
بالإضافة إلى تفضيلات الطعام التي
تُعد متغيرًا لطبقة البيانات.
ولا تنس أن تقوم بالنشر.
حسنًا، إنه دورك الآن.
إنك ستقوم بإنشاء متغير تفضيل الطعام
والمُشغل و
سنبدأ عرض الطبق النباتي المميز
اليومي.
للبدء، أنشئ متغير طبقة البيانات
لتفضيلات الطعام و
أنشئ متغير مجموعة القيم للطبق النباتي
اليومي الخاص.
وأفضل طريقة للقيام بذلك هي
نسخ و
تعديل الطبق المميز اليومي
الموجود بالفعل.
اختر مُشغلاً مخصصًا له، وأنشئ المُشغل
النباتي واستخدمه.
وما آخر خطوة يجب ألا
تنساها؟
النشر.
حسنًا، تابع العمل وقم بهذه الأشياء.
ثم جرّبها في التطبيق الخاص بك.
Agora que escrevemos o código
para salvar a preferência de comida
na camada de dados,
podemos criar variáveis no gerenciador de tags
para manter o prato do dia
para cada tipo de preferência de comida.
Primeiro, precisamos criar
uma variável de camada de dados
para manter a preferência de comida.
Então vamos para tela Variables,
criamos uma nova variável.
E dessa vez é importante
escolher Data Layer Variable.
Nomeie a variável, esse nome
é para você identificar
o que há na variável.
E, em seguida, você configura a variável.
A única coisa que você pode definir
para Data Layer Variable
é o nome da variável
que está usando em seu código.
Esse nome precisa corresponder
exatamente à chave que você definiu em seu código.
No meu caso eu usei a chave food_pref,
portanto minha variável deve ser configurada
para o nome da variável para ser food_pref.
Você pode definir
o valor padrão se quiser.
Minha definição será irrestrito.
Crie a variável.
Agora temos a variável food pref.
A próxima coisa a fazer
é criar os pratos do dia
para as diferentes preferências de comida.
A maneira mais fácil de criar
uma nova variável
é copiar uma existente.
Vou copiar daily-special-en,
Copy
Não deixe de renomeá-lo.
Veja que o tipo
é um Value Collection.
Configure a variável,
defina o valor,
escolha um bom prato vegano do dia,
de sua preferência.
Como copiamos uma variável existente
temos os acionadores
que vêm com essa variável.
E precisamos nos livrar deles.
Exclua todos os acionadores existentes
e crie um novo acionador personalizado.
Essa lista de acionadores
não inclui o acionador que queremos,
então criamos um novo.
E será o acionador
vegano.
Custom está ok.
E você quer que ele dispare
quando a preferência da comida for vegana.
Procure por food preference, contains,
ou melhor, equals vegan.
Save the trigger,
Create the variable,
e agora temos o daily-special-vegan
para a variável Value Collection.
Bem como food pref
que é uma Data Layer Variable.
E não se esqueça de publicar.
Muito bem, agora é a sua vez.
Você vai criar
a variável food pref e o acionador
iniciará
mostrando um prato do dia vegano.
Para começar, crie a variável food-pref
DataLayer
e depois
crie uma variável de coleção de valor
para o prato do dia vegano.
E o modo mais fácil
de fazer isso é copiar
e editar o daily-special-en
que já existe.
Escolha um acionador personalizado para isso
e crie e use
o acionador vegano.
E qual o último passo
que você não pode esquecer?
Publicar.
Vá fazer essas coisa.
E depois experimente em seu aplicativo.
现在我们已经编写了在数据层保存食物偏好的代码
我们可以在 Tag Manager 中创建变量
为每种食物偏好配置一个每日特色菜
首先 我们需要创建一个数据层变量以容纳食物偏好
来到变量页面 创建一个新变量
这次 选择数据层变量很重要
命名变量 变量名称是为了确定变量中有什么
然后配置变量
可为数据层变量配置的唯一项目是
在代码使用的变量名称
该名称必须准确匹配代码中设置的键
在我的案例中 我使用了 food_pref 键
因此我的变量必须将变量名称配置为 food_pref
如果愿意 可以设置默认值
我打算将其设置为无限制
创建变量
现在我们有了食物偏好变量
下一步要做的事情是
为不同的食物偏好创建每日特色菜
创建新变量最容易的方式是复制现有变量
我打算复制 daily-special-en 复制
务必对其重命名
注意 类型选择 Value Collection
配置变量 设置值
选择当天的一个很好的素食特色菜 你觉得不错的任何选项
由于我们复制了现有的变量 我们已经获得了随该变量而来的
触发器
我们需要删除这些触发器
删除所有现有触发器 创建一个新的自定义触发器
现在触发器列表不包括我们想要的触发器 因此
我们创建一个新的触发器
将其命名为 Vegan Trigger
自定义非常好
当食物偏好为素食时 触发触发器
寻找目前包含甚至以前包含的等于素食的食物偏好
保存触发器 创建变量
现在我们有 Value Collection 变量 daily-special-vegan
还有食物偏好 这是一个数据层变量
不要忘了发布
好了 现在该你了
你将创建食物偏好变量以及触发器
我们开始展示一个素食每日特色菜
首先 创建 food-pref 数据层变量
然后为素食每日特色菜创建一个 Value Collection 变量
执行此步骤的最简单的方式是
复制和编辑已经存在的 daily-special-en
为其选择一个自定义触发器 然后创建并使用素食触发器
你一定不要忘的最后一步是什么?
发布
好了 继续完成这些步骤
然后在你的应用上试一下