Home > Paid Traffic Sources >

My Tracker Setup For Tiktok (23)


03-14-2022 12:58 PM #1 twinaxe (Senior Moderator)
My Tracker Setup For Tiktok

Today I would like to show you how I set up Tiktok as a trafficsource in my tracker.

Maybe it sounds pretty uninteresting but for me personally that setup is pretty helpful so I hope others can also benefit from it.

Let me first show you few things so that you can see why I wanted to improve the setup.

These are the tracking tokens from Tiktok that I use:

- Click ID: __CLICKID__
- Adgroup Name: __AID_NAME__
- Adgroup ID: __AID__
- Creative Name: __CID_NAME__
- Creative ID: __CID__
- Placement: __PLACEMENT__



All of these metrics apart from Click ID are only for my own stats to see which elements perform good and which not.

Click ID however is needed for the postback, to send conversion info back to Tiktok through an API.

All these tokens are always the same for each and every campaign and don´t require a special setup.

Now let´s have a look at the postback.

To send conversion info to Tiktok I use the solution from @zeno that you can find HERE

The postback URL that I use is like this

Code:
https://us-central1-helper-cloud-functions.cloudfunctions.net/tiktok-s2s-api?ttclid={externalid}&access_token=abcdefg1234567&event_name=SubmitForm&currency=USD&revenue={payout}&pixel_id=1234567abcdefg
The tokens can change depending on what tracker you use but as you can see in the ttclid parameter I use the {externalid} token to send the Click ID that I received from Tiktok so that TT can attribute each conversion to one specific click.

Then we have the access_token parameter, there I use the access token that I received from zenos app that passes the information then to Tiktoks API.

In the event_name parameter I set the name of the *surprise surpise* Optimization Event that was used in the campaign/adgroup.

The pixel_id parameter is obviously the pixel ID that I used for that campaign/adgroup.

This is already working 100% flawless but it also leads to few issues that I wanted to avoid.

As you can see in the example postback above the values for access token, event name and pixel ID are in plain text and usually you can can only use 1 postback URL per trafficsource in a tracker.

If you want to use a different pixel ID you have to setup a new trafficsource in your tracker with that pixel ID.
If you want to use a different access token you also have to setup a new trafficsource in your tracker with that access token.
And if you want to use a different event name you also have to setup a new trafficsource in your tracker with that event name.

This can lead to many different Tiktok trafficsources in your tracker just because of some small changes in the postback.

If only there would be a way to avoid it...

When we check the postback URL again we can see that Tiktoks click ID gets dynamically inserted with the {externalid} token so I just added few more parameters to pass the other values also dynamically to the postback.

Check here Token 6, Token 7 and Token 8



The postback URL also has to be edited a little bit so that it now looks like this

Code:
https://us-central1-helper-cloud-functions.cloudfunctions.net/tiktok-s2s-api?ttclid={externalid}&access_token={t7}&event_name={t8}&currency=USD&revenue={payout}&pixel_id={t6}
As you can see, the previously plain text values for access token, event name and pixel ID are now replaced with the dynamic tokens.

But it´s not only the postback URL that changed, the campaign URL also has 3 more parameters attached.

Before the campaign URL for a Tiktok campaign was something like this

Code:
https://trackingdomain.com/click.php?key=12345abcde&ttclid=__CLICKID__&adgroup_name=__AID_NAME__&adgroup_id=__AID__&creative_name=__CID_NAME__&creative_id=__CID__&placement=__PLACEMENT__
Now the campaign URL is something like this

Code:
https://trackingdomain.com/click.php?key=12345abcde&ttclid=__CLICKID__&adgroup_name=__AID_NAME__&adgroup_id=__AID__&creative_name=__CID_NAME__&creative_id=__CID__&placement=__PLACEMENT__&1=___PIXEL_ID___&2=___API___&3=___EVENT___
In creative setup I just paste the campaign URL and change the dummy tokens for pixel ID, access token (api parameter) and event name to the ones that I want to use.

That way the different values get dynamically passed to the postback URL depending on what values I set in the campaign URL and I can use one postback for all my pixels, access tokens and also for all different event names.

I hope that´s helpful for some of you as well, at least for me it´s a great way to avoid setting up a separate Tiktok trafficsource when I want to use a different pixel, access token or conversion event.


03-14-2022 02:04 PM #2 vortex (Senior Moderator)

Definitely a much-needed tutorial! Thanks so much for writing it!



Amy


03-14-2022 06:03 PM #3 affpayinggao (Veteran Member)

Thanks for the info. This is exactly what I was searching for


03-14-2022 11:59 PM #4 twinaxe (Senior Moderator)

Quote Originally Posted by affpayinggao View Post
Thanks for the info. This is exactly what I was searching for
That´s great to hear


03-15-2022 08:48 PM #5 cpvlabpro (Member)

This method of having a single Postback URL even if you use multiple pixels/events is interesting and certainly something that works.


But I wouldn't really recommend this approach because it comes with security vulnerabilities by exposing critical data in the Campaign URL: the Pixel ID and mainly the API Access Token.

These values should be kept private inside the tracker and not included in an URL that can be seen by anybody, otherwise it may be a security issue.
There are many spy tools that grab Campaign URLs and you will end with your secret API Access Token exposed on many websites.


Our approach in CPV Lab Pro is to define the Pixel ID and Event Name in the tracker at campaign level, so you can have different Pixel ID / Event Name combinations for each campaign if you want. This means that you have only one TikTok Traffic Source declaration in the tracker with the general details, while specific details(Pixel ID, Event Name, currency) are defined for each campaign.

All sensitive information like Pixel ID and especially the API Access Token are kept only in the tracker and used only in the API calls.


Then we have the direct TikTok API integration which passes the ClickID and all other conversion details in a secure manner to TikTok. Everything happens inside the tracker, without third-party components and without exposing the API Access Token and Pixel ID.

Hope this helps.

Radu


03-15-2022 09:42 PM #6 twinaxe (Senior Moderator)

Thanks for your input, I can't deny that these are absolutely valid points.

In my tracker (Binom) I can also set individual postbacks per campaign but here I don't use that feature because even in the same tracker campaign the values can be changing so that I need to use postbacks with several different dynamic values in one campaign.

There it doesn't help when I can use one individual postback per campaign.

I mostly don't use the values long enough to cause real damage anyway.

Nonetheless you are right that generally it's not the best idea to send sensitive data through the campaign URL.

Another option could be to set individual postbacks with the static values for that campaign on a campaign level and additionally send changing values through the campaign link for a dynamic postback.

Btw, I just checked your Tiktok API integration and there it says

"Unfortunately, TikTok doesn’t offer other tokens for Ad, Gender, Age etc. In order to know which ad the visitor came from you will need to specify the AdID in the Destination URL for each of your ad.

Notice how the above URL has “&ad=Ad5” at the end. This means that CPV Lab Pro will track Ad5 in the Ad Token for all visitors from this ad. The same can be done for each of the ads you define, with unique Ad IDs."

Actually Tiktok does offer tokens for ad ID and few other things, check my opening post for some examples.


03-16-2022 01:44 PM #7 cpvlabpro (Member)

Thank you for the heads-up on the tokens accepted by TikTok that were missing from our DOC page! You're right, those are valid tokens.

We will get those added ASAP and the documentation updated.


03-18-2022 06:09 AM #8 isha_18 (Member)

Hey @twinaxe,
I really appreciate the guide for tracker setup. I was really in need of this, I setup FunnelFlux tracker as you mentioned but when I sent a test conversion it is not been displaying in the tracker and as well as on the adv platform that is everflow. I am not sure what went wrong. I would really appreciate your help


03-18-2022 03:21 PM #9 twinaxe (Senior Moderator)

@isha_18 it´s next to impossible to tell what went wrong without knowing more details.

Please explain as good as possible what exactly you did so that we can try to find out where the issue is.


03-18-2022 05:36 PM #10 isha_18 (Member)

Quote Originally Posted by twinaxe View Post
@isha_18 it´s next to impossible to tell what went wrong without knowing more details.

Please explain as good as possible what exactly you did so that we can try to find out where the issue is.
Can I just PM you to explain in detail?


03-18-2022 05:39 PM #11 twinaxe (Senior Moderator)

Sure, no problem


03-18-2022 05:58 PM #12 isha_18 (Member)

Just did. Please check it up


04-23-2022 07:08 PM #13 stungads (Senior Member)

@twinaxe or anyone else that might know how to resolve this.

I switched to another network to try a similar offer within the same vertical. On this network the conversions are showing up, but they're not posting on TikTok. I tried to debug this issue with my affiliate manager but it seems like we're both stuck at this point. The network uses their own proprietary software for tracking(not HasOffers/Cake). There were 2 things I thought was the issue 1) I didn't add the &ttclid=__CLICKID__ to the end of the tracking link or 2) The pixel I originally setup was with the other network and I thought I could've used the same pixel, but in actuality the pixel is Event API based and this network doesn't support TT API yet.

So, I thought I'd create a new pixel, instead of choosing Events API setup I did TT pixel. When I was setting up the new campaign, I couldn't select the pixel because I didn't create some type of event. So I went back and created a Submit Form Event and URL Contains(siteid=498289384 <----- this section was grabbed at the end of the funnel for lead gen). I really thought by doing this I would've fixed the issue, but it still didn't work. I'm getting conversions on the network but it's not posting on TT. I even tried it with and without the &ttclid=__CLICKID__

I've asked my affiliate manager if there was anything the offer owner needed to do on their end, he said no as he placed the TT pixel on the global level on the affiliate network.

<script>
!function (w, d, t) {
w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on" ,"off","once","ready","alias","group","enableCooki e","disableCookie"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))} };for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,t tq.methods[i]);ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,tt q.methods[n]);return e},ttq.load=function(e,n){var i="https://analytics.tiktok.com/i18n/pixel/events.js";ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=i,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=i+"?sdkid="+e+"&lib=" +t;var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)};


ttq.load('MY PIXEL ID');
ttq.page();
}(window, document, 'ttq');
</script>











Now I'm wondering if the TYPE below should be postback instead of HTML. The postback will be the tracking link with the &ttclid=__CLICKID__ at the end. But, I don't think so as I'm not using a 3rd party tracking software like Voluum/Binom. I'm simply direct linking this campaign.



04-26-2022 11:09 PM #14 stungads (Senior Member)

Quote Originally Posted by stungads View Post
<script>
!function (w, d, t) {
w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on" ,"off","once","ready","alias","group","enableCooki e","disableCookie"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))} };for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,t tq.methods[i]);ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,tt q.methods[n]);return e},ttq.load=function(e,n){var i="https://analytics.tiktok.com/i18n/pixel/events.js";ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=i,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=i+"?sdkid="+e+"&lib=" +t;var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)};


ttq.load('MY PIXEL ID');
ttq.page();
}(window, document, 'ttq');
</script>

For anyone interested in the solution, from my understanding this is only for affiliate networks that don't have API Integration setup yet. Still figuring out the Binom tracking side, I think I'm almost there. But, I'm stuck at what I'm supposed to put into the postback url of the traffic source(TT). I think that's the only part I'm missing.

If you want to purely direct link a campaign and not use a tracker then here's how I was able to finally get the conversion posted on TikTok. My AM and I were scratching our heads at this until he reached out to other AMs to see how other affiliates do it. I'm going to try and remember everything I did and relay it here.

1) Setup a Web Event - TikTok Pixel - Developer Mode as recommended by @zeno. Follow the Preface - Creating Pixels & Priming Events Steps. So glad he put that link to prime events because prior to reading his post the way I did it was to activate the event was out of pure luck just by fudging around with link syntax. In layman's terms, that by clicking that test-resources.funnelflux.pro link w/ your pixel ID you're activating the events that TikTok has which enables you to select the pixel when you create the campaign. Please don't ever delete that link Zeno

2) Once that's done, you can ask your affiliate manager or do it yourself to post the following script as HTML. Change the PIXEL ID and the only piece I was missing was the part highlighted in bold(I'm on the corner crying now.....)

<script>
!function (w, d, t) {
w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on" ,"off","once","ready","alias","group","enableCooki e","disableCookie"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))} };for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,t tq.methods[i]);ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,tt q.methods[n]);return e},ttq.load=function(e,n){var i="https://analytics.tiktok.com/i18n/pixel/events.js";ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=i,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=i+"?sdkid="+e+"&lib=" +t;var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)};


ttq.load("PUTYOURPIXELIDHERE");
ttq.track("SubmitForm");
ttq.page();
}(window, document, "ttq");
</script>


04-29-2022 11:28 AM #15 twinaxe (Senior Moderator)

@stungads PM sent


05-27-2022 03:44 PM #16 stungads (Senior Member)

Hey @twinaxe, when you're in Binom and you look at a specific ad group does it look like this? I'm trying to update the costs manually on Binom, but some of the costs flow through the __AID Name__. Because of this the costs displayed isn't accurate to the ad group. For example, the costs on 05-23-22 is $77.33, but it flows through the main ad group and then __AID Name__ and then Unknown. I've copied the same way you setup your traffic source on Binom.



05-27-2022 06:26 PM #17 twinaxe (Senior Moderator)

I´m not sure if I get what you mean

The traffic that goes to __AID Name__ is from reviewers and stuff so I wouldn´t bother with it.

Just grab the stats for the ad groups and dates that you want to update and then update the cost for these ad groups accordingly in Binom.

When you update the costs for the different ad groups properly with the cost that you get from Tiktok it doesn´t matter how much traffic went to __AID Name__ or Unknown, you will see the real numbers for these ad groups in your tracker.


05-27-2022 08:50 PM #18 stungads (Senior Member)

Quote Originally Posted by twinaxe View Post
I´m not sure if I get what you mean

The traffic that goes to __AID Name__ is from reviewers and stuff so I wouldn´t bother with it.

Just grab the stats for the ad groups and dates that you want to update and then update the cost for these ad groups accordingly in Binom.

When you update the costs for the different ad groups properly with the cost that you get from Tiktok it doesn´t matter how much traffic went to __AID Name__ or Unknown, you will see the real numbers for these ad groups in your tracker.
Yeap that's what I did. I updated the costs manually.

So when I click on [Payout filter > 3] etc...... and click the update costs I inputted $77.33. And it spread the costs within 3 of the groupings in the screenshot above. Like 90% goes to the [Payout Filter & amp....., 5% goes to __AID_Name__, 1% goes to unknown. I couldn't isolate the costs just to that one ad group. I reached out to Binom support and they don't have a solution for that.

I was just wondering if yours looks the same way.


05-27-2022 09:34 PM #19 twinaxe (Senior Moderator)

Ah ok, now I get it.

No, I don´t have that issue but I guess I know what´s going on.

When you select the ad group and click "Update Costs" then it updates the cost for the whole campaign.



You need to go with the mouse to the ad group you want to select and then right click the mouse.

Then you can choose to update cost for only that ad group




05-27-2022 10:47 PM #20 stungads (Senior Member)

Oh.... got it thanks!


05-30-2022 11:54 AM #21 twinaxe (Senior Moderator)

Quote Originally Posted by stungads View Post
Oh.... got it thanks!

Most important is that it works now


07-26-2022 06:53 AM #22 vtredskins (Member)

@twinaxe great post! I am learning a lot and trying to set this up. I have a question regarding the postback URL. would that be the same for everyone? I think I have the issue with that postback since none of my parameters are passing from TikTok to Binom.


07-29-2022 01:32 AM #23 innovativ (Junior Member)

If ya'll don't mind me asking, how important is a tracker like this for TT + Shopify eComm?

I used Voluum way back when doing mobile pops/pins, so it was super necessary to drilldown carriers and devices. But I'm not sure how relevant this is for eComm, I usually just monitor campaign/adset/ad by labeling my UTM parameters and seeing them pass back in GA + Shopify analytics. TikTok also has some reporting that isn't completely worthless as FB, so I can get a general idea of some placements/gender/etc. Although tbh anytime I try a targeted campaign it doesn't do me much good anyway.

Am I missing out on anything or is it mostly just for the pixel for affiliates?


Home > Paid Traffic Sources >