• Courses
    • Courses
    • Course bundles
  • Blog
  • Services
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • About
    • About
    • Contact
  • Login
  • Courses
    • Courses
    • Course bundles
  • Blog
  • Services
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • About
    • About
    • Contact
  • Login

February 28, 2023

How to reuse GA4 ecommerce data in Tiktok Pixel

This will be a short blog post (because all the necessary things are covered in the video below). But I hope to find more time in the future and turn this into a wholesome article.

This blog post presumes that you have already installed Tiktok Pixel with Google Tag Manager. If you haven’t done that, watch this tutorial first.

 

Video: Reuse GA4 e-commerce data in Tiktok Pixel

In the video below, I am using Google Tag Manager to do that.

At one point in the video, I will mention a JavaScript code that you need to use in a Custom JavaScript variable. Here it is:

function(){
  var ec = INSERT_YOUR_ECOMMERCE_VARIABLE_HERE; 
  var ecItems = ec.items
  return ecItems.map(function(product){
    return {
      "content_id" : !!product.item_id ? product.item_id.toString() : undefined,
      "price" : !!product.price ? parseFloat(product.price) : undefined,
      "quantity" : !!product.quantity ? parseInt(product.quantity) : undefined,
      "content_name" : !!product.item_name ? product.item_name.toString() : undefined
    } 
  })
}

Make sure you create a Data Layer variable accessing the ecommerce object (version 1). Then replace the INSERT_YOUR_ECOMMERCE_VARIABLE_HERE part with that variable.

This variable will take all products that are available in the data layer (ecommerce.items) and then outputs the format supported by the Tiktok Pixel.

 

Final words

Also, don’t forget to use Tag Sequencing and make sure that your Pixel base tag (implemented with a Custom HTML tag) fires before the event tag.

But the base code does not “like” when it fires multiple times, these your Custom HTML tag should be set to fire only once per page.

Julius Fedorovicius
In Google Tag Manager Tips
0 COMMENTS

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *

 

Hi, I'm Julius Fedorovicius and I'm here to help you learn Google Tag Manager and Google Analytics. Join thousands of other digital marketers and digital analysts in this exciting journey. Read more
Analytics Mania
  • Google Tag Manager Courses
  • Google Tag Manager Recipes
  • Google Tag Manager Resources
  • Google Tag Manager Community
  • Login to courses
Follow Analytics Mania
  • Subscribe to newsletter
Recent Posts
  • Track Videos with Google Analytics 4 and Google Tag Manager
  • Debugging Incorrect & Missing Google Analytics 4 Transactions
  • A Guide to Referrer in Google Tag Manager
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings