You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then, the following code should be placed towards the bottom of your
227
-
html doc or deferred. This initializes the data layer and the global
228
-
header classes
248
+
If for some reason your setup includes the script after the window load event has already occurred, you can call the initialization functions directly, by using the global variable <strong>{`unityBootstrap`}</strong>.
229
249
</p>
230
250
<pre>
231
-
{" "}
232
251
<code>
233
252
{`
234
-
<script></head>
235
-
window.initDataLayer();
236
-
window.initGlobalHeader();
237
-
</script></head>
253
+
<script>
254
+
/* Only use if the script did not automatically initialize with the window load event */
255
+
unityBootstrap.initDataLayer();
256
+
unityBootstrap.initGlobalHeader();
257
+
</script>
238
258
`}
239
-
</code>{" "}
259
+
</code>
260
+
</pre>
261
+
262
+
<aid="watchdatalayer"></a>
263
+
<h2>Watching the data layer</h2>
264
+
<p>
265
+
Drag this link to your bookmarks bar. When you are on a page with
266
+
data layer events, clicking the bookmarklet will execute a tiny
267
+
script which will output data layer events to the console.<br/><br/>
268
+
<ahref={bookmarklet}>Watch DataLayer</a>
269
+
</p>
270
+
<h3>
271
+
Only Run Code You Trust
272
+
</h3>
273
+
<p>
274
+
As a user, always exercise caution when running code. Only click
275
+
or add bookmarklets if at least one of the following applies:
276
+
<ul>
277
+
<li>
278
+
The source is reputable.
279
+
</li>
280
+
<li>
281
+
You understand JavaScript and have reviewed the code
282
+
yourself.
283
+
</li>
284
+
<li>
285
+
A trusted individual who knows JavaScript has reviewed the
0 commit comments