javascript - Inserting GTM variable instead of HTML object -


i'm trying implement marketing tag on website value needed on tag should come html object, although when trying replace gtm variable, no data transferred tag.

these instructions documentation:

for google tag manager (gtm) integration, create html-object (jquery required) containing , replace variables real data values (cf. next section).

html-object @ checkout page

<div id='transactionstring' data-transaction-string='data'></div> 

create custom html-tag in gtm following code snippet , pass data new html object. finally, can add checkout page trigger rules of gtm.

create custom html tag in gtm

<script src="https://tracking.crealytics.com/lib/multi_conversion.min.js"></script> <script type="text/javascript"> var transactionstring =   $("#transactionstring").data("transaction-string"); __multi_conversion_tracking(70, "transactionstring");  </script> <noscript> <div style="display:inline;">  <img> src="https://tracking.crealytics.com/70/multi_check.php?data=transactionstring"> </div> </noscript> 

everything ready in datalayer, formatting , values correct, problem when pass these values variable of gtm.

this custom html tag set in gtm:

<script type="text/javascript"> var transactionstring =   $({{variableingtm}}).data("transaction-string"); __multi_conversion_tracking(70, "transactionstring");  </script> <noscript> <div style="display:inline;">  <img> src="https://tracking.crealytics.com/70/multi_check.php?data=transactionstring"> </div> </noscript> 

so in short, replaced

"#transactionstring"

for

{{variableingtm}}

edit:

 var divelement = document.createelement("div");    divelement.id = "transactionstring";   divelement.setattribute('data-transaction-string', products_info); 


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -