-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addition TikTok as a Provider #113
Conversation
v1.16.1 Release
…ed TIKTOK16x16.png to src/assets/images/icons and updated icons.scss accordingly
@johndavidsimmons let me know if having a URL available where all the TikTok events can easily be observed would be useful for completing this review & I can publish the necessary pixels to a site I have control of. |
Hey sorry I was out of town, I will review some time this week. |
What is business.topbuzz.com? I see the tiktok provider class tracking requests from that URL, but the tiktok pixel is sending post requests to https://analytics.tiktok.com/api/v1/track |
@johndavidsimmons the TikTok events send a GET request with the same data to the business.topbuzz.com endpoint, but as query string parameters. It's unclear why this is the case, but it has been observed that the GET requests are typically sent first. If necessary I can refactor to use the POST requests that are sent to the analytics.tiktok.com endpoint. |
FWIW TopBuzz and TikTok are both owned by ByteDance. |
Looks like you might get 2 for 1 here. I would add tiktok and topbuzz as separate providers with the tiktok provider parsing the post data to sent to analytics.tiktok.com and the topbuzz provider parsing the query param data being sent to business.topbuzz.com |
@jaredrileysmith - so if you're on a single site, it'll send it to both domains, or are these two separate tags? Can you send me a URL that has TikTok on it (you can send it privately to philip@omnibug.io if want to keep it out of the public eye). If its the latter, I'm not sure it's worth creating two providers for - it looks like topbuzz was technically shut down. |
@MisterPhilip I'll email you the URL where all the TikTok standard events are configured to fire on the home page. |
I'm a little conflicted here, since they are largely contain the same payloads and it seems like it's a single base code that is sending data to both locations. Given that TopBuzz seems to be going away, and TikTok's requests are better formatted, I think we should stick with just the TikTok request. @jaredrileysmith / @johndavidsimmons do you see any value in keeping both or do you agree that sticking with one would be best? Example from TikTok: {
"event": "Purchase",
"context": {
"ad": {
"ad_id": "",
"req_id": "",
"creative_id": "",
"log_extra": "{}",
"idc": "",
"convert_id": "",
"callback": ""
},
"user": {
"user_id": "",
"device_id": ""
},
"pixel": {
"code": "YYYYYYYYYYYYYYYYYYYYY"
},
"page": {
"url": "https://domain.example.com/",
"referrer": "https://referrer.example.com"
},
"library": {
"version": "0.0.24",
"name": "pixel.js"
}
},
"analytics_uniq_id": "xxxxxxxxxxxxxxxxxxxx",
"timestamp": "2020-09-03T20:35:14.262Z"
} Example from TopBuzz:
|
Correct, both are sent from the same JS file: getHttpConvertUrl: function() {
var e = X || G.getFromSessionStorage("umeng_idc");
switch (e + "") {
case "3":
return "//business-sg.topbuzz.com/2/wap/landing_tetris_log/";
default:
return "//business.topbuzz.com/2/wap/landing_tetris_log/"
}
},
getInterface3Url: function() {
return "https://analytics.tiktok.com/api/v1/track"
}, The regex would need to be updated to match the |
@MisterPhilip I don't see any value in having both & I agree that the POST requests are a little better formatted, etc. I also agree that it's probably best to use the POST requests, given the uncertain nature of TopBuzz, etc. Moving forward, should I delete this pull request & submit a new one once the changes are made? Apologies for the ignorance, this is my first-ever pull request. |
@jaredrileysmith - sounds good. Let's stick with the TikTok domain then. For your pull request, you're fine! Just make the updates to the file and commit to your |
@MisterPhilip thanks for the clarification, I should have the update ready some time this weekend. |
@MisterPhilip I'm having a little trouble getting started. I started with just the constructor in the Any insight you can provide would be greatly appreciated, apologies if I've overlooked something apparent. |
Hmm, I can't seem to replicate that error - and all of the requests I've seen have been POST data with JSON as the body. Can you look at the network requests to see what requests are sent and if there are any with empty bodies/malformed JSON objects? Just to confirm, below is the same as what you have, correct? class TikTokProvider extends BaseProvider {
constructor() {
super();
this._key = "TIKTOK";
this._pattern = /https:\/\/analytics\.tiktok\.com\/api\/v1\/track/;
this._name = "TikTok";
this._type = "marketing";
this._keywords = ["TikTok"];
}
} |
@MisterPhilip I cleared the error from the extension and refreshed after building again & the error is no longer present. I have gotten all the events to display as desired with the POST data and will be writing the requisite tests in the next couple of days to update this pull request. Thanks again for all your help. |
@MisterPhilip I am almost finished writing the test suite for this provider, but am having trouble with a test to ensure the provider returns the
|
Wrap the POST data in a string, since it'll attempt to do a full parse on it. e.g.: viewContentPostData = `{"event":"ViewContent","context":{"ad":{"ad_id":"","req_id":"","creative_id":"","log_extra":"{}","idc":"","convert_id":"","callback":""},"user":{"user_id":"","device_id":""},"pixel":{"code":"BT24M8TQUU2IQ2BVG9NG"},"page":{"url":"https%3A%2F%2Fdigital-intelligence.myshopify.com%2F","referrer":""},"library":{"version":"0.0.24","name":"pixel.js"}},"analytics_uniq_id":"yhczscrde4u6oe9lpmuns","timestamp":"2020-09-04T11:22:12.959Z"}`, |
@MisterPhilip I tried wrapping the POST data in a string & also tried to call |
Hmm, actually I'm wrong - you can pass an object as POST data. (sorry!) Are you returning a results.push({
"key": "mboxType",
"field": "Mbox Type",
"value": matches[2],
"group": "general"
}); It should be whatever the value of the get columnMapping()
{
return {
"account": "mbox",
"requestType": "mboxType"
};
} |
@MisterPhilip thanks for the clarification. I am returning a
The
I'll keep looking into the methods for the |
Use viewContentResult = viewContentParsed.data.find((result) => {
return result.key === "event";
}),
purchaseResult = purchaseParsed.data.find((result) => {
return result.key === "event";
}),
checkoutResult = checkoutParsed.data.find((result) => {
return result.key === "event";
}); |
@MisterPhilip I accidentally created another pull request. Should I close this one out? |
…ded TIKTOK16x16.png to src/assets/images/icons and updated icons.scss accordingly