The W3C data layer is multi-level deep and follows the W3C syntax, which isn't the best practice for Tealium's Tag Management implementation. Tealium's utag_data object is a flat data layer and one layer deep. The converter code will transform the W3C Data Layer to follow utag_data object's syntax. Post conversion, all the variables will be available for Load Rules, Mappings, etc. 

The W3C Converter Code is attached as Additional Resources for this article. This ready-to-use code does not require changes as long as the W3C data layer adheres to the W3C syntax, which is outlined in this link. Otherwise, the code has to be modified suitably. 

Adding the converter code using Javascript Code Extension

  1. Navigate to the Extensions tab in the console.
  2. Click the add extension.png button to open the Extensions marketplace.
  3. Select the Advanced tab. Click the plus symbol for 'Javascript Code' to add it to your profile.

    javascript code.png
  4. Enter a descriptive title for the extension.
  5. Set the scope to Pre loader.
  6. Paste the converter code (attached as 'W3C Converter Code' in Additional Resources) into the extension's code editor.
  7. To save this extension, you will need to approve it for publishing. Click the  approve for publish.pngbutton.
  8. To run this extension, you have to save and publish the version. Click the  button.
  9. In the Save/Publish dialog box, click the 'Save As' button and select the publish environment.
  10. Click 'Publish' at the bottom-right corner of the dialog box.

Take it a step further and test the code in your sandbox using the four sample data layer objects (Confirmation Page, Cart Page, Page, and Product Page) attached to this article.

Getting Started with The Data Layer
1. The Data Layer Explained
2. Adding Data Sources
3. Data Source Types
4. W3C Data Layer Converter
Attachments
Version history
Revision #:
12 of 12
Last update:
‎10-28-2020 02:53 PM
Updated by: