@darrion.kuhn
To add datalayer.push on WordPress functions.php, you can follow these steps:
1 2 3 4 5 6 7 8 9 10 11 |
add_action('wp_head', 'add_datalayer_push');
function add_datalayer_push() {
?>
<script>
dataLayer.push({
'key': 'value'
});
</script>
<?php
}
|
Replace 'key': 'value' with your specific data that you want to push into the data layer. You can add multiple key-value pairs or complex objects if needed.
Now, when a visitor loads a page on your WordPress website, the add_datalayer_push function will be triggered, adding your specified data to the data layer.