• Courses
    • Courses
    • Course bundles
  • Blog
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • Services
  • About
    • About
    • Contact
  • Login
  • Courses
    • Courses
    • Course bundles
  • Blog
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • Services
  • 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.

Subscribe and Get the Ebook - JavaScript for Google Tag Manager

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,
      "content_type" : "product"
    } 
  })
}

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
7 COMMENTS
Matej
  • Mar 31 2023
  • Reply

Hi Julius, I've followed your advice however I'm getting issue reported in TikTok debug.

"The content type for one or more of your events is invalid. Content type must be either "product" or "product_group"."

This is happening for initiate checkout and purchase events when i have Multiple Contents selected. Is it not automatically set to be product group?

    Julius Fedorovicius
    • Mar 31 2023
    • Reply

    Hi, I just updated to include content_type : product.

    Check if that works/helps

      Matej
      • Mar 31 2023
      • Reply

      Hi Julius,

      Yes this helped! Wasn't sure if i should use product_group or product. This works!

      Thank you.

        Julius Fedorovicius
        • Mar 31 2023
        • Reply

        I just hardcoded the value "product" because that's what is usually used by most companies :)

Anna
  • Apr 17 2023
  • Reply

Hi Julius,

thank you for the manual, it really helped.

I just have one question. While using the tag from gallery where I select enhanced ecommerce I do have issue with the currency. The TikTok pixels shows USD even if in eec object is different currency. Is there a way to fix that?

Thank you in advance.

julian
  • Jun 20 2023
  • Reply

Hi Julius,

as far as i can see tiktok has now added the possibility to use custom events.
can you please add the topic in this article?

thx
julian

Gabriele
  • Sep 23 2024
  • Reply

Hi, I followed your guide but the tik tok browser and client event tags do not activate and in the tag firing it says "exception thrown", what does it mean? The pixel helper does not find them. I configured the pixel with custom htm with the tag thrown once per page trigger all pages, that is detected and tracked correctly, I selected that the tag events must be activated only after the tik tok pixel, but nothing, the events in "limited exception" are always thrown; I could not find the tag error even in your guide to generate tags that are not thrown. Can you help me?

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
  • Google Tag Manager Server-Side Tagging with Stape
  • How to Preserve Ad Click IDs with Server-side Tagging
  • LinkedIn Conversions API with Google Tag Manager. The Guide.
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings