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

Replace instances of space with adUnit where needed #230

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions r3f/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Import the ZestyBanner component and add it to the scene like so:

```js
<ZestyBanner
adUnit={'YOUR_ADUNIT_ID'}
format={'YOUR_ADUNIT_FORMAT'}
adUnit={'YOUR_AD_UNIT_ID'}
format={'YOUR_AD_UNIT_FORMAT'}
position={[X, Y, Z]} />
```

Expand Down
2 changes: 1 addition & 1 deletion utils/helpers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ export function checkUserPlatform(): Promise<{
}>;
export function openURL(url: any): void;
export function urlContainsUTMParams(url: any): boolean;
export function appendUTMParams(url: any, spaceId: any): string;
export function appendUTMParams(url: any, adUnitId: any): string;
export function visibilityCheck(bbMin: number[], bbMax: number[], cameraProjMatrix: number[], cameraWorldMatrix: number[]): boolean;
4 changes: 2 additions & 2 deletions utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ const urlContainsUTMParams = (url) => {
return url.indexOf('utm_source=') !== -1 || url.indexOf('utm_campaign=') !== -1 || url.indexOf('utm_channel=') !== -1;
}

const appendUTMParams = (url, spaceId) => {
const appendUTMParams = (url, adUnitId) => {
let new_url = new URL(url)
new_url.searchParams.set('utm_source', 'ZestyMarket');
new_url.searchParams.set('utm_campaign', 'ZestyCampaign');
new_url.searchParams.set('utm_channel', `SpaceId_${spaceId}`);
new_url.searchParams.set('utm_channel', `AdUnitId_${adUnitId}`);
return new_url.href;
}

Expand Down
10 changes: 5 additions & 5 deletions utils/networking.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export function fetchCampaignAd(adUnitId: any, format?: string, style?: string): Promise<any>;
/**
* Increment the on-load event count for the space
* @param {string} spaceId The space ID
* Increment the on-load event count for the ad unit
* @param {string} adUnitId The ad unit ID
* @returns A Promise representing the POST request
*/
export function sendOnLoadMetric(spaceId: string, campaignId?: any): Promise<void>;
export function sendOnClickMetric(spaceId: any, campaignId?: any): Promise<void>;
export function analyticsSession(spaceId: any, campaignId: any): Promise<void>;
export function sendOnLoadMetric(adUnitId: string, campaignId?: any): Promise<void>;
export function sendOnClickMetric(adUnitId: any, campaignId?: any): Promise<void>;
export function analyticsSession(adUnitId: any, campaignId: any): Promise<void>;
16 changes: 8 additions & 8 deletions utils/networking.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,44 +206,44 @@ Check https://docs.zesty.xyz/guides/developers/ad-units for more information.`);
}

/**
* Increment the on-load event count for the space
* @param {string} spaceId The space ID
* Increment the on-load event count for the ad unit
* @param {string} adUnit The ad unit ID
* @returns A Promise representing the POST request
*/
const sendOnLoadMetric = async (spaceId, campaignId = null) => {
const sendOnLoadMetric = async (adUnitId, campaignId = null) => {
const { platform, confidence } = await checkUserPlatform();

try {
await axios.post(
BEACON_GRAPHQL_URI,
{ query: `mutation { increment(eventType: visits, spaceId: \"${spaceId}\", campaignId: \"${campaignId}\", platform: { name: ${platform}, confidence: ${confidence} }) { message } }` },
{ query: `mutation { increment(eventType: visits, spaceId: \"${adUnitId}\", campaignId: \"${campaignId}\", platform: { name: ${platform}, confidence: ${confidence} }) { message } }` },
{ headers: { 'Content-Type': 'application/json' } }
)
} catch (e) {
console.log("Failed to emit onload event", e.message)
}
};

const sendOnClickMetric = async (spaceId, campaignId = null) => {
const sendOnClickMetric = async (adUnitId, campaignId = null) => {
const { platform, confidence } = await checkUserPlatform();

try {
await axios.post(
BEACON_GRAPHQL_URI,
{ query: `mutation { increment(eventType: clicks, spaceId: \"${spaceId}\", campaignId: \"${campaignId}\", platform: { name: ${platform}, confidence: ${confidence} }) { message } }` },
{ query: `mutation { increment(eventType: clicks, spaceId: \"${adUnitId}\", campaignId: \"${campaignId}\", platform: { name: ${platform}, confidence: ${confidence} }) { message } }` },
{ headers: { 'Content-Type': 'application/json' } }
)
} catch (e) {
console.log("Failed to emit onclick event", e.message)
}
}

const analyticsSession = async (spaceId, campaignId) => {
const analyticsSession = async (adUnitId, campaignId) => {
const { platform, confidence } = await checkUserPlatform();
try {
await axios.post(
BEACON_GRAPHQL_URI,
{ query: `mutation { increment(eventType: session, spaceId: \"${spaceId}\", campaignId: \"${campaignId}\", platform: { name: ${platform}, confidence: ${confidence} }) { message } }` },
{ query: `mutation { increment(eventType: session, spaceId: \"${adUnitId}\", campaignId: \"${campaignId}\", platform: { name: ${platform}, confidence: ${confidence} }) { message } }` },
{ headers: { 'Content-Type': 'application/json' } }
)
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions wonderland/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ Make sure that you set up a cursor to enable clicking.

## Configuring

To set up the `zesty-banner` component, make sure to create an account and space on the market,
To set up the `zesty-banner` component, make sure to create an account and ad unit on the market,
[find more info here](https://zestyxyz.notion.site/Docs-346d6f9aa8544cf9a5484c3ccf61523a).

1. Right-click "root" > Add Object > Mesh.
2. Set mesh to "PrimitivePlane".
3. Create a material in "Views > Resources > Materials".
4. Assign the material to your plane.
5. Add a `zesty-banner` component and copy your creator ID and space ID into the respective
5. Add a `zesty-banner` component and copy your creator ID and ad unit ID into the respective
fields.
Loading