Skip to content
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

feat: remove the index from ad id for easier identification #88

Merged
merged 2 commits into from
Nov 15, 2024

Conversation

Wkkkkk
Copy link
Contributor

@Wkkkkk Wkkkkk commented Nov 15, 2024

This commit removed the index from the id in pod ads.
It would then be easy to identify each creative by their UniversalAdId or adId.

One open question is whether to do the same for stand-alone ads or not.

@@ -152,9 +152,9 @@ function AttachStandAloneAds(vast, ads, params, podSize) {
     if (vast.attrs.version === "4.0") {
       mediaNode = mediaNode
       .addUniversalAdId(
-        encodeURIComponent(`${ads[i].universalId}${i + podSize}`), {
+        encodeURIComponent(`${ads[i].universalId}`), {
           idRegistry: "test-ad-id.eyevinn",
-          idValue: encodeURIComponent(`${ads[i].universalId}${i + podSize}`),
+          idValue: encodeURIComponent(`${ads[i].universalId}`),
         }
       );
     }

@Wkkkkk
Copy link
Contributor Author

Wkkkkk commented Nov 15, 2024

@birme This makes it easier to use transcoded creatives as they now have a unique name, which could be used as key in CouchDB.

@birme birme requested a review from Nfrederiksen November 15, 2024 13:32
@birme
Copy link
Contributor

birme commented Nov 15, 2024

@birme This makes it easier to use transcoded creatives as they now have a unique name, which could be used as key in CouchDB.

Looks good to me but I have @Nfrederiksen have the final saying

@Nfrederiksen
Copy link
Collaborator

Nfrederiksen commented Nov 15, 2024

@Wkkkkk Can you clarify what you mean by each creative having a unique name by removing the index postfix? :) I don't understand. If the index is not there then the same ad creatives will appear multiple times in a VAST would they not? Index was originally there to 'fake' it being a different ad ^^'

@Wkkkkk
Copy link
Contributor Author

Wkkkkk commented Nov 15, 2024

We actually want to know if there exist same ad creatives in the VAST response so that we can transcode them beforehand and reuse the transcoded ones by their id.

To be clear, this means that an example VAST would look like this before this change:

<Creative id="CRETIVE-ID_001" adId="black-friday1" sequence="1">
  <UniversalAdId idRegistry="test-ad-id.eyevinn" idValue="AAA%2FFFFF123%2F1"><![CDATA[AAA%2FFFFF123%2F1]]</UniversalAdId>
...

And after:

<Creative id="CRETIVE-ID_001" adId="black-friday" sequence="1">
  <UniversalAdId idRegistry="test-ad-id.eyevinn" idValue="AAA%2FFFFF123%2F"><![CDATA[AAA%2FFFFF123%2F]]</UniversalAdId>
...

The id in Creative would still be indexed but the adId will not, neither will idValue in UniversalAdId. So one could use adId as a key to identify this creative and transcode it for later use.

If the same creative is included in the response as the next one. It would look like:

<Creative id="CRETIVE-ID_002" adId="black-friday" sequence="2">
  <UniversalAdId idRegistry="test-ad-id.eyevinn" idValue="AAA%2FFFFF123%2F"><![CDATA[AAA%2FFFFF123%2F]]</UniversalAdId>
...

@Wkkkkk
Copy link
Contributor Author

Wkkkkk commented Nov 15, 2024

To your last question, we are still "faking" them to be different creatures since these two creatives would have different id (CRETIVE-ID_001 and CRETIVE-ID_002).

@Nfrederiksen
Copy link
Collaborator

I understand now. You transcode per adId.

Would it be possible to use the mediafile URL as a key?

I am a little hesitant to not being able to 'fake' that all universalAdId in a VAST are unique.
But at the same time, letting two creatives have matching universalAdId's might be a worthy use case to want to test with the Test Ad Server.....

@Wkkkkk
Copy link
Contributor Author

Wkkkkk commented Nov 15, 2024

I see your concerns.

It is true that one could use the URL path as key but it seems over-complicated. I was doing it this way because stand-alone ads are named by just id.

@@ -146,15 +146,15 @@ function AttachStandAloneAds(vast, ads, params, podSize) {
       .attachCreatives()
       .attachCreative({
         id: `CREATIVE-ID_00${i + podSize}`,
         [adId]: `${ads[i].id}`,
         sequence: `${i + podSize}`,
       });

@Nfrederiksen
Copy link
Collaborator

Yeah... AttachStandAloneAds should have the ability to attach universaladids too. I wonder if that function is actually called on a normal vast request ^^' will have to look into that.

I see your point. But consider the case when we use "TENANT_AD_LIST", aka an external list. Now if that list happens to have different URL's but the same AdID on several items then you'd transcode the same source multiple times there too.
Now yes, not everyone using the test ad server will need to perform a transcoding job, But I think it will cover more cases if the key is unique for each URL. Maybe you can base64 encode it even.

@Nfrederiksen
Copy link
Collaborator

Nfrederiksen commented Nov 15, 2024

OK @Wkkkkk here is a suggested solution.
We remove the index on adId only. and let the UniversalAdId keep the index. I think having all universalAdId's unique per creative is good enough
... And so you should be able to use the adId's as simple keys, unique per URL.

Or maybe you can just slice the last character (the index) on each id, when you parse the VAST in your service...

@Wkkkkk
Copy link
Contributor Author

Wkkkkk commented Nov 15, 2024

Let's remove the index on adId then.

@Nfrederiksen
Copy link
Collaborator

LGTM let it fire

@Wkkkkk
Copy link
Contributor Author

Wkkkkk commented Nov 15, 2024

Only you and Jonas can merge it.

@Nfrederiksen Nfrederiksen merged commit 0ea6d01 into main Nov 15, 2024
2 checks passed
@Wkkkkk Wkkkkk deleted the feat/remove-index-from-ad-id branch November 15, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants