tiktok / gtm-template-pixel

Apache License 2.0
14 stars 1 forks source link

Automatically load TikTok base pixel #18

Open luukfiets opened 2 months ago

luukfiets commented 2 months ago

Currently this tag template only checks whether the base tag is present but doesn't load the base tag in case it was not found. It would be really useful if the tiktok base pixel would be injected if it was not found, just like the Meta tag template does.

Please let me know if I can help with setting this up. I'm happy to suggest the required changes.

tt-hubenlin commented 2 months ago

Thank you for your suggestion. Currently our GTM interactive setup flow will help users install base-code tags and template tags. Could you provide the link to the tag template you mentioned? We will carefully evaluate the benefits and other impacts of providing this feature.

luukfiets commented 2 months ago

@tt-hubenlin, of course: on these lines the Facebook tag template checks whether the fbq library is already loaded: https://github.com/facebookarchive/GoogleTagManager-WebTemplate-For-FacebookPixel/blob/main/template.tpl#L548-L553.

If it's not loaded yet, it initiates the pixel (first loading consent status before actually injecting the tracking script) and then loads the actual script: https://github.com/facebookarchive/GoogleTagManager-WebTemplate-For-FacebookPixel/blob/main/template.tpl#L555-L619.

This setup makes it easier to set up the pixel for non-tech savvy users.