I have a javascript marketing tag which I'd like to implement using Google Tag Manager, but it requires a number of dataLayer variables to be passed dynamically into it. Namely the user ID (e.g. transactionId) and action name (e.g. transactionProduct)
The code begins like this:
<script type="text/javascript">
var _tvq = _tvq || [];
(function () {
var session = {'user': '**<USERREF>**'};
var actionname = '**<ACTIONNAME>**';
var action = {'rev': '**<REVENUE>**', 'prod': '**<PRODUCT>**', 'id': '**<ACTIONID>**', 'promo': '**<PROMOCODE>**'};
What is the best way to do this? Should I input using {{}} - i.e. {{transactionId}}?
Apologies if this is a super simple question - I'm still figuring things out! Any help would be hugely appreciated!
Cheers,
Rosie
Yes, exactly as you have mentioned. Create the macros for them first, ie. user ref would be {{userRef}}, action name would be {{actionName}}, product would be {{product}}, etc. Your remarketing tag will then have access to them, as long as you reference them correctly using {{}}.