diff --git a/.github/styles/Microsoft/HeadingAcronyms.yml b/.github/styles/Microsoft/HeadingAcronyms.yml index 6674d3e80..64a25536b 100644 --- a/.github/styles/Microsoft/HeadingAcronyms.yml +++ b/.github/styles/Microsoft/HeadingAcronyms.yml @@ -24,3 +24,5 @@ exceptions: - AAR - CPU - IDE + - SKAN + - SKAD diff --git a/.github/styles/config/vocabularies/Adjust/accept.txt b/.github/styles/config/vocabularies/Adjust/accept.txt new file mode 100644 index 000000000..d8afa6e1e --- /dev/null +++ b/.github/styles/config/vocabularies/Adjust/accept.txt @@ -0,0 +1,11 @@ +MUST +MUST NOT +REQUIRED +SHALL +SHALL NOT +SHOULD +SHOULD NOT +RECOMMENDED +NOT RECOMMENDED +MAY +OPTIONAL diff --git a/.schema/List.markdoc.js b/.schema/List.markdoc.js new file mode 100644 index 000000000..a8d34d757 --- /dev/null +++ b/.schema/List.markdoc.js @@ -0,0 +1,51 @@ +import markdoc from "@markdoc/markdoc"; +const { Tag } = markdoc; + +/** + * A function to transform checkbox markers ([ ] and [x]) into checkboxes + * @param children The child elements of the list item + * @returns Updated children with checkboxes added if necessary + */ +function transformListItemChildren(children) { + return children.flatMap((child, index) => { + if (typeof child === 'string' && index === 0) { + if (child.startsWith("[ ]")) { + return [ + new Tag("input", { type: "checkbox" }, []), + child.slice(3).trim() + ]; + } else if (child.startsWith("[x]")) { + return [ + new Tag("input", { type: "checkbox", checked: "", }, []), + child.slice(3).trim() + ]; + } + } else if (child instanceof Tag) { + // Recursively call this function on nested lists + return new Tag(child.name, child.attributes, transformListItemChildren(child.children)); + } + + return child; + }); +} + +export const list = { + children: ['item'], + attributes: { + ordered: { type: Boolean, default: false }, + marker: { type: String } + }, + transform(node, config) { + const attributes = node.transformAttributes(config); + const children = node.transformChildren(config); + // If it's an ordered list, do nothing + if (attributes.ordered) return new Tag("ol", attributes, children.map(child => new Tag("li", {}, child.children))); + + // If the list is unordered, apply the transformation + return new Tag("ul", attributes, children.map(child => { + // Transform each list item + const listItemChildren = transformListItemChildren(child.children); + return new Tag("li", {}, listItemChildren); + })); + } +}; diff --git a/.vale.ini b/.vale.ini index 34f9e2018..2653af741 100644 --- a/.vale.ini +++ b/.vale.ini @@ -3,9 +3,12 @@ IgnoredScopes = code, tt, img, url, a SkippedScopes = script, style, pre, figure, code MinAlertLevel = warning # suggestion, warning or error +Vocab = Adjust + # Force Vale to treat MDX files as markdown [formats] mdx = md +mdoc = md # Only Markdown and .txt files; change to whatever you're using. [*.md] diff --git a/markdoc.config.mjs b/markdoc.config.mjs index a5fcb6020..b329bbf9d 100644 --- a/markdoc.config.mjs +++ b/markdoc.config.mjs @@ -2,15 +2,19 @@ import { defineMarkdocConfig, nodes, component } from '@astrojs/markdoc/config'; import { heading } from ".schema/Heading.markdoc"; import { link } from ".schema/Link.markdoc"; import { paragraph } from ".schema/Paragraph.markdoc"; +import { list } from ".schema/List.markdoc"; import versions from "src/versionMap.json"; +import variables from "src/variables.json"; export default defineMarkdocConfig({ variables: { - versions + versions, + variables }, nodes: { heading, link, + list, paragraph, fence: { attributes: { ...nodes.fence.attributes }, @@ -123,7 +127,7 @@ export default defineMarkdocConfig({ } }, tabs: { - render: component("src/components/Tab.astro"), + render: component("src/components/Tabs.astro"), }, } }) diff --git a/src/components/ListColumns.astro b/src/components/ListColumns.astro index d396801b8..215c0478c 100644 --- a/src/components/ListColumns.astro +++ b/src/components/ListColumns.astro @@ -3,7 +3,7 @@ const content = Astro.slots.has("default") ? await Astro.slots.render("default") : ""; -const lists = content.split("
"); +const lists = content.split(//); ---
diff --git a/src/components/utils/parseDefList.ts b/src/components/utils/parseDefList.ts index 99186f78a..c76a90a94 100644 --- a/src/components/utils/parseDefList.ts +++ b/src/components/utils/parseDefList.ts @@ -1,24 +1,45 @@ import { unified } from "unified"; import rehypeParse from "rehype-parse"; import rehypeStringify from "rehype-stringify"; -import type { Element, Root } from "hast"; +import type { Element, Root, Text } from "hast"; + +/** + * Extracts text content from an element's children recursively. + * @param children The children of the element. + * @returns The concatenated text content. + */ +const getTextContent = (children: (Element | Text)[]): string => { + return children + .map((child) => { + if (child.type === 'text') { + return child.value; + } else if (child.type === 'element') { + // Recursively get the text content of nested elements + return getTextContent(child.children as (Element | Text)[]); + } + return ''; + }) + .join(''); +}; /** * Checks if a value is a definition list term. - * @param text The text value of the element. + * @param children The children of the element. * @returns Whether the value of the element is a term. */ -const isTerm = (text: string): boolean => { - return /^\S[^: ].*$/.test(text.trim()); +const isTerm = (children: (Element | Text)[]): boolean => { + const text = getTextContent(children).trim(); + return /^\S[^: ].*$/.test(text); }; /** * Checks if a value is a definition list description. - * @param text The text value of the element. - * @returns Whether the value of the element is a term. + * @param children The children of the element. + * @returns Whether the value of the element is a description. */ -const isDescription = (text: string): boolean => { - return /^(:|\s)/.test(text.trim()); +const isDescription = (children: (Element | Text)[]): boolean => { + const text = getTextContent(children).trim(); + return /^(:|\s)/.test(text); }; /** @@ -53,78 +74,78 @@ export const parseDefList = async (htmlString: string): Promise => { children.forEach((element) => { if (element.type === 'element') { if (element.tagName === 'p') { - const text = element.children - .filter((child): child is Element & { value: string } => child.type === 'text') - .map((child) => child.value) - .join("") - .trim(); + const textChildren = element.children as (Element | Text)[]; - // Perform this action for each term - if (isTerm(text)) { + // Check if this paragraph contains a term + if (isTerm(textChildren)) { // If we reach a new term, we need to finish appending the descriptions to the last term we were working on. if (currentTerm) { - // Add the term to the list + // Push the last term and its descriptions dlNode.children.push(currentTerm); - // Add all collected descriptions currentDescription.forEach(dd => dlNode.children.push(dd)); currentDescription = []; } - // If this is the first term, assign it as the current term. currentTerm = { type: "element", tagName: "dt", - children: [{ type: "text", value: text }], + children: textChildren, // Keep all children, including inline formatting properties: {}, }; - } else if (isDescription(text) && currentTerm) { - // If the element is a description (paragraph starting with whitespace or a colon), add it to the currentDescription array + } else if (isDescription(textChildren) && currentTerm) { currentDescription.push({ type: "element", tagName: "dd", - children: [{ type: "text", value: text.replace(/^:/, "").trim() }], + children: [{ + type: "element", + tagName: "p", + children: textChildren.map(child => { + if (child.type === 'text') { + // Strip leading colon or whitespace for descriptions + return { + ...child, + value: child.value.replace(/^:/, '').trim(), + }; + } + return child; + }), + properties: {}, + }], properties: {}, }); } } else { - // If the element isn't a paragraph tag, it will be a description + // Non-paragraph elements are considered descriptions if (currentTerm) { - // If we have an ongoing term, finalize it dlNode.children.push(currentTerm); currentTerm = null; - // Add all collected descriptions currentDescription.forEach(dd => dlNode.children.push(dd)); currentDescription = []; } - // Wrap all elements that aren't a paragraph in a
tag const ddElement: Element = { type: "element", tagName: "dd", - children: [element], + children: [element], // Wrap the non-paragraph element properties: {}, }; - // Add the description element to the definition list dlNode.children.push(ddElement); } } }); - // Finalize the last term-description pair if it exists + // Finalize the last term-description pair if (currentTerm) { dlNode.children.push(currentTerm); - if (currentDescription.length > 0) { - currentDescription.forEach(dd => dlNode.children.push(dd)); - } + currentDescription.forEach(dd => dlNode.children.push(dd)); } - // Overwrite the entire tree with the new
node + // Replace the tree with the new
node tree.children = [dlNode]; }; }) - .use(rehypeStringify); // Convert the result to a string so we can use set:html + .use(rehypeStringify); - // Process and return the transformed HTML const result = await processor.process(htmlString); return String(result); }; diff --git a/src/content/docs/sdk/cocos2dx/configuration-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/configuration-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/configuration-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/configuration-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/configuration-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/configuration-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/configuration-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/configuration-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/configuration-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/configuration-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/configuration-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/configuration-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/configuration.mdx b/src/content/docs/sdk/cocos2dx/v4/configuration.mdx similarity index 98% rename from src/content/docs/sdk/cocos2dx/configuration.mdx rename to src/content/docs/sdk/cocos2dx/v4/configuration.mdx index 47fd62f66..906e85c4c 100644 --- a/src/content/docs/sdk/cocos2dx/configuration.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/configuration.mdx @@ -2,8 +2,16 @@ title: Configuration description: Follow the guides in this section to configure the Adjust SDK. category-title: Configuration -slug: en/sdk/cocos2dx/configuration +slug: en/sdk/cocos2dx/v4/configuration sidebar-position: 1 +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/configuration --- Use the methods in this document to configure the behavior of the Adjust SDK. diff --git a/src/content/docs/sdk/cocos2dx/features/ad-revenue-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/ad-revenue-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/ad-revenue-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/ad-revenue-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/ad-revenue-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/ad-revenue-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/ad-revenue-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/ad-revenue-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/ad-revenue-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/ad-revenue-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/ad-revenue-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/ad-revenue-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/ad-revenue.mdx b/src/content/docs/sdk/cocos2dx/v4/features/ad-revenue.mdx similarity index 98% rename from src/content/docs/sdk/cocos2dx/features/ad-revenue.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/ad-revenue.mdx index 4eccc16d9..0d8f5872f 100644 --- a/src/content/docs/sdk/cocos2dx/features/ad-revenue.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/features/ad-revenue.mdx @@ -1,7 +1,15 @@ --- title: Send ad revenue information description: Send ad revenue information for supported network partners using the Adjust SDK. -slug: en/sdk/cocos2dx/features/ad-revenue +slug: en/sdk/cocos2dx/v4/features/ad-revenue +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features/ad-revenue --- You can record ad revenue for [supported network partners](https://help.adjust.com/en/article/ad-revenue) using the Adjust SDK. diff --git a/src/content/docs/sdk/cocos2dx/features/att-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/att-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/att-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/att-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/att-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/att-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/att-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/att-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/att-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/att-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/att-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/att-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/att.mdx b/src/content/docs/sdk/cocos2dx/v4/features/att.mdx similarity index 96% rename from src/content/docs/sdk/cocos2dx/features/att.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/att.mdx index e21153b0d..c7b6728d1 100644 --- a/src/content/docs/sdk/cocos2dx/features/att.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/features/att.mdx @@ -1,7 +1,15 @@ --- title: Set up App Tracking Transparency description: Configure your app to use Apple's App Tracking Transparency framework -slug: en/sdk/cocos2dx/features/att +slug: en/sdk/cocos2dx/v4/features/att +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features/att --- If you want to record the device's ID for Advertisers (IDFA), you must display a prompt to get your user's authorization. To do this, you need to include Apple's App Tracking Transparency (ATT) framework in your app. The Adjust SDK stores the user's authorization status and sends it to Adjust's servers with each request. diff --git a/src/content/docs/sdk/cocos2dx/features/attribution-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/attribution-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/attribution-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/attribution-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/attribution-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/attribution-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/attribution-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/attribution-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/attribution-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/attribution-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/attribution-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/attribution-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/attribution.mdx b/src/content/docs/sdk/cocos2dx/v4/features/attribution.mdx similarity index 95% rename from src/content/docs/sdk/cocos2dx/features/attribution.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/attribution.mdx index 49362687a..f7f55c10c 100644 --- a/src/content/docs/sdk/cocos2dx/features/attribution.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/features/attribution.mdx @@ -1,7 +1,15 @@ --- title: Get attribution information description: Listen for attribution changes using the Adjust SDK -slug: en/sdk/cocos2dx/features/attribution +slug: en/sdk/cocos2dx/v4/features/attribution +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features/attribution --- When a user interacts with an Adjust link, their attribution information updates. This can happen if the user interacts with a [deep link](https://help.adjust.com/en/article/deep-links). Information about a user's attribution is represented in the `AdjustAttribution2dx` class. diff --git a/src/content/docs/sdk/cocos2dx/features/callbacks-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/callbacks-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/callbacks-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/callbacks-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/callbacks-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/callbacks-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/callbacks-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/callbacks-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/callbacks-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/callbacks-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/callbacks-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/callbacks-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/callbacks.mdx b/src/content/docs/sdk/cocos2dx/v4/features/callbacks.mdx similarity index 98% rename from src/content/docs/sdk/cocos2dx/features/callbacks.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/callbacks.mdx index fe7424c04..000db2a03 100644 --- a/src/content/docs/sdk/cocos2dx/features/callbacks.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/features/callbacks.mdx @@ -1,7 +1,15 @@ --- title: Send callback information description: Use these methods to send callback information to Adjust. -slug: en/sdk/cocos2dx/features/callbacks +slug: en/sdk/cocos2dx/v4/features/callbacks +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features/callbacks --- Set up callbacks to trigger functions when the SDK sends information to Adjust. You can set up callbacks for **sessions** and **events**. diff --git a/src/content/docs/sdk/cocos2dx/features/deep-links-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/deep-links-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/deep-links-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/deep-links-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/deep-links-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/deep-links-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/deep-links-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/deep-links-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/deep-links-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/deep-links-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/deep-links-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/deep-links-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/deep-links.mdx b/src/content/docs/sdk/cocos2dx/v4/features/deep-links.mdx similarity index 93% rename from src/content/docs/sdk/cocos2dx/features/deep-links.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/deep-links.mdx index b63a384e4..3aae77deb 100644 --- a/src/content/docs/sdk/cocos2dx/features/deep-links.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/features/deep-links.mdx @@ -2,7 +2,15 @@ title: Deep linking description: Follow the guides in this section to set up deep linking. category-title: Deep linking -slug: en/sdk/cocos2dx/features/deep-links +slug: en/sdk/cocos2dx/v4/features/deep-links +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features/deep-links --- You can create deep links to take users to specific pages in your app. The Adjust SDK uses different logic depending on if the user already has your app installed on their device: diff --git a/src/content/docs/sdk/cocos2dx/features/device-info-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/device-info-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/device-info-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/device-info-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/device-info-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/device-info-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/device-info-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/device-info-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/device-info-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/device-info-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/device-info-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/device-info-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/device-info.mdx b/src/content/docs/sdk/cocos2dx/v4/features/device-info.mdx similarity index 91% rename from src/content/docs/sdk/cocos2dx/features/device-info.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/device-info.mdx index 158529649..060312e66 100644 --- a/src/content/docs/sdk/cocos2dx/features/device-info.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/features/device-info.mdx @@ -1,7 +1,15 @@ --- title: Get device information description: Use these methods to add details to your callbacks and improve your reporting. -slug: en/sdk/cocos2dx/features/device-info +slug: en/sdk/cocos2dx/v4/features/device-info +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features/device-info --- The Adjust SDK contains helper methods that return device information. Use these methods to add details to your callbacks and improve your reporting. diff --git a/src/content/docs/sdk/cocos2dx/features/events-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/events-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/events-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/events-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/events-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/events-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/events-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/events-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/events-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/events-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/events-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/events-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/events.mdx b/src/content/docs/sdk/cocos2dx/v4/features/events.mdx similarity index 98% rename from src/content/docs/sdk/cocos2dx/features/events.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/events.mdx index 0ce17235b..1fdaf3b47 100644 --- a/src/content/docs/sdk/cocos2dx/features/events.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/features/events.mdx @@ -1,7 +1,15 @@ --- title: Send event information description: Use these methods to send event information to Adjust. -slug: en/sdk/cocos2dx/features/events +slug: en/sdk/cocos2dx/v4/features/events +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features/events --- The Adjust SDK provides an `AdjustEvent2dx` object which can be used to structure and send event information from your app to Adjust's servers. diff --git a/src/content/docs/sdk/cocos2dx/features/index-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/index-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/index-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/index-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/index-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/index-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/index-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/index-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/index-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/index-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/index-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/index-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/v4/features/index.mdx b/src/content/docs/sdk/cocos2dx/v4/features/index.mdx new file mode 100644 index 000000000..52b717fcd --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v4/features/index.mdx @@ -0,0 +1,18 @@ +--- +title: Features +description: Use the Adjust SDK to send in-app information to Adjust's servers. +category-title: Features +slug: en/sdk/cocos2dx/v4/features +type: category +sidebar-position: 3 +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features +--- + +Use the Adjust SDK to send in-app information to Adjust's servers. diff --git a/src/content/docs/sdk/cocos2dx/features/privacy-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/privacy-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/privacy-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/privacy-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/privacy-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/privacy-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/privacy-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/privacy-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/privacy-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/privacy-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/privacy-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/privacy-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/privacy.mdx b/src/content/docs/sdk/cocos2dx/v4/features/privacy.mdx similarity index 99% rename from src/content/docs/sdk/cocos2dx/features/privacy.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/privacy.mdx index 8bb9d0ca9..4fb86f435 100644 --- a/src/content/docs/sdk/cocos2dx/features/privacy.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/features/privacy.mdx @@ -1,7 +1,15 @@ --- title: Set up privacy features description: Configure features that you can use to handle user privacy in your app. -slug: en/sdk/cocos2dx/features/privacy +slug: en/sdk/cocos2dx/v4/features/privacy +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features/privacy --- The Adjust SDK contains features that you can use to handle user privacy in your app. diff --git a/src/content/docs/sdk/cocos2dx/features/session-parameters-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/session-parameters-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/session-parameters-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/session-parameters-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/session-parameters-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/session-parameters-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/session-parameters-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/session-parameters-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/session-parameters-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/session-parameters-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/session-parameters-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/session-parameters-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/session-parameters.mdx b/src/content/docs/sdk/cocos2dx/v4/features/session-parameters.mdx similarity index 95% rename from src/content/docs/sdk/cocos2dx/features/session-parameters.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/session-parameters.mdx index 43bac742d..f6fd222e5 100644 --- a/src/content/docs/sdk/cocos2dx/features/session-parameters.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/features/session-parameters.mdx @@ -1,7 +1,15 @@ --- title: Configure session parameters description: Send information to your callback URL with each session. -slug: en/sdk/cocos2dx/features/session-parameters +slug: en/sdk/cocos2dx/v4/features/session-parameters +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features/global-parameters --- If you [register a callback URL](https://help.adjust.com/en/article/recommended-placeholders-callbacks) in the Adjust dashboard, Adjust sends a GET request to your callback URL when the SDK measures a session. diff --git a/src/content/docs/sdk/cocos2dx/features/short-links-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/short-links-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/short-links-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/short-links-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/short-links-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/short-links-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/short-links-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/short-links-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/short-links-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/short-links-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/short-links-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/short-links-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/short-links.mdx b/src/content/docs/sdk/cocos2dx/v4/features/short-links.mdx similarity index 90% rename from src/content/docs/sdk/cocos2dx/features/short-links.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/short-links.mdx index 720a1fac7..324a53be9 100644 --- a/src/content/docs/sdk/cocos2dx/features/short-links.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/features/short-links.mdx @@ -1,7 +1,15 @@ --- title: Resolve short branded links description: Resolve short links that were created in Campaign Lab. -slug: en/sdk/cocos2dx/features/short-links +slug: en/sdk/cocos2dx/v4/features/short-links +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features/short-links --- Adjust's [link shortener solution](https://help.adjust.com/en/article/short-branded-links) converts your complex and long links into cleaner and shorter links. The shortened links retain deep link and campaign information, and route users to the app store, if they don't have your app installed. diff --git a/src/content/docs/sdk/cocos2dx/features/skad-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/skad-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/skad-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/skad-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/skad-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/skad-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/skad-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/skad-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/skad-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/skad-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/skad-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/skad-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/skad.mdx b/src/content/docs/sdk/cocos2dx/v4/features/skad.mdx similarity index 96% rename from src/content/docs/sdk/cocos2dx/features/skad.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/skad.mdx index 8be6c7fc2..6c412f47d 100644 --- a/src/content/docs/sdk/cocos2dx/features/skad.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/features/skad.mdx @@ -1,7 +1,15 @@ --- title: Set up SKAdNetwork and conversion values description: Configure SKAdNetwork features for your iOS apps. -slug: en/sdk/cocos2dx/features/skad +slug: en/sdk/cocos2dx/v4/features/skad +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features/skan --- diff --git a/src/content/docs/sdk/cocos2dx/features/subscriptions-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/features/subscriptions-ja.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/subscriptions-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/subscriptions-ja.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/subscriptions-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/features/subscriptions-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/subscriptions-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/subscriptions-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/subscriptions-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/features/subscriptions-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/features/subscriptions-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/subscriptions-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/features/subscriptions.mdx b/src/content/docs/sdk/cocos2dx/v4/features/subscriptions.mdx similarity index 98% rename from src/content/docs/sdk/cocos2dx/features/subscriptions.mdx rename to src/content/docs/sdk/cocos2dx/v4/features/subscriptions.mdx index de937a105..91ea40c54 100644 --- a/src/content/docs/sdk/cocos2dx/features/subscriptions.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/features/subscriptions.mdx @@ -1,7 +1,15 @@ --- title: Send subscription information description: Use these methods send subscription information to Adjust. -slug: en/sdk/cocos2dx/features/subscriptions +slug: en/sdk/cocos2dx/v4/features/subscriptions +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/features/subscriptions --- diff --git a/src/content/docs/sdk/cocos2dx/index-ja.mdx b/src/content/docs/sdk/cocos2dx/v4/index-ja.mdx similarity index 99% rename from src/content/docs/sdk/cocos2dx/index-ja.mdx rename to src/content/docs/sdk/cocos2dx/v4/index-ja.mdx index 430a9e819..d7e9f268f 100644 --- a/src/content/docs/sdk/cocos2dx/index-ja.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/index-ja.mdx @@ -3,7 +3,6 @@ title: "Cocos2d-x SDK 連携ガイド" description: "Cocos2d-xアプリでAdjustの機能にアクセスするには、Web SDKを使用してください" category-title: "Cocos2d-x SDK" slug: "ja/sdk/cocos2dx" -sidebar-position: 7 --- AdjustのAndroid SDKを実装することで、アトリビューション、イベント、さらにその他のさまざまなデータをCocos2d\-xアプリで記録できます。Adjust SDKをアプリに実装するには、以下の手順に従ってください。 diff --git a/src/content/docs/sdk/cocos2dx/index-ko.mdx b/src/content/docs/sdk/cocos2dx/v4/index-ko.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/index-ko.mdx rename to src/content/docs/sdk/cocos2dx/v4/index-ko.mdx diff --git a/src/content/docs/sdk/cocos2dx/index-zh.mdx b/src/content/docs/sdk/cocos2dx/v4/index-zh.mdx similarity index 100% rename from src/content/docs/sdk/cocos2dx/index-zh.mdx rename to src/content/docs/sdk/cocos2dx/v4/index-zh.mdx diff --git a/src/content/docs/sdk/cocos2dx/index.mdx b/src/content/docs/sdk/cocos2dx/v4/index.mdx similarity index 98% rename from src/content/docs/sdk/cocos2dx/index.mdx rename to src/content/docs/sdk/cocos2dx/v4/index.mdx index 658fe9ab2..e0bd3df6b 100644 --- a/src/content/docs/sdk/cocos2dx/index.mdx +++ b/src/content/docs/sdk/cocos2dx/v4/index.mdx @@ -2,8 +2,16 @@ title: Cocos2d-x SDK integration guide description: Use the Web SDK to access Adjust's features in your Cocos2d-x apps category-title: Cocos2d-x SDK -slug: en/sdk/cocos2dx +slug: en/sdk/cocos2dx/v4 sidebar-position: 7 +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx --- The Adjust Android SDK enables you to record attribution, events, and more in your Cocos2d-x app. Follow the steps in this guide to set up your app to work with the Adjust SDK. diff --git a/src/content/docs/sdk/cocos2dx/v5/configuration.mdoc b/src/content/docs/sdk/cocos2dx/v5/configuration.mdoc new file mode 100644 index 000000000..8eed27ec7 --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/configuration.mdoc @@ -0,0 +1,221 @@ +--- +title: Configuration +description: Follow the guides in this section to configure the Adjust SDK. +category-title: Configuration +slug: en/sdk/cocos2dx/configuration +sidebar-position: 1 +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/configuration +--- + +Use the methods in this document to configure the behavior of the Adjust SDK. + +## Instantiate your config object {% #instantiate-your-config-object %} + +To configure the Adjust SDK, you need to instantiate an `AdjustConfig2dx` object. This object contains the **read-only** configuration options that you need to pass to the Adjust SDK. + +To instantiate your config object, create a new `AdjustConfig2dx` instance and pass the following parameters: + +{% deflist %} +`appToken` (`std::string`) + +: Your [Adjust app token](https://help.adjust.com/en/article/app-token-and-reporting-currency#view-your-app-details). + +`environment` (`std::string`) + +: The environment you want to run the SDK in. + +- Pass `AdjustEnvironmentSandbox2dx` to run the SDK in sandbox mode for testing. +- Pass `AdjustEnvironmentProduction2dx` to run the SDK in production mode for release. +{% /deflist %} + +You can also pass the following optional parameter: + +{% deflist %} +`allowSuppressLogLevel` (`bool`) + +: Whether to suppress all logging. Set to `true` to suppress logging or `false` to enable logging. +{% /deflist %} + +```cpp +#include "Adjust/Adjust2dx.h" + +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment, false); +Adjust2dx::initSdk(adjustConfig); +``` + +## Read-only configuration {% #read-only-configuration %} + +**Read-only** configuration options are set in your `AdjustConfig2dx` instance **before** the initialization of the SDK. They can't be changed while the SDK is running. You MUST configure any options you want to use before running `Adjust2dx::initSdk`. + +### Set your logging level {% #set-your-logging-levelt %} + +The Adjust SDK provides configurable log levels to return different amounts of information. The following log levels are available: + +| Log level | Description | +| ------------------------------------------ | ------------------------------------------ | +| `AdjustLogLevel2dxVerbose` | Enable all logging | +| `AdjustLogLevel2dxDebug` | Enable debug logging | +| `AdjustLogLevel2dxInfo` | Only show info level logs (default option) | +| `AdjustLogLevel2dxWarn` | Disable info logging | +| `AdjustLogLevel2dxError` | Disable warning level logging and below | +| `AdjustLogLevel2dxAssert` | Disable error level logging and below | +| `AdjustLogLevel2dxSuppress` | Suppress all logging | + +You can set your log level by calling the `setLogLevel` method on your `AdjustConfig2dx` instance with the following parameter: + +{% deflist %} +`logLevel` (`ADJLogLevel2dx`) + +: The log level you want to use. +{% /deflist %} + +```cpp +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setLogLevel(AdjustLogLevel2dxVerbose); +Adjust2dx::initSdk(adjustConfig); +``` + +### Set external device identifier {% #set-external-device-id %} + +{% callout type="seealso" %} +See the [External device identifiers article](https://help.adjust.com/en/article/external-device-identifiers) in the Adjust help center for more information. +{% /callout %} + +An external device identifier is a custom value that you can assign to a device or user. They help you recognize users across sessions and platforms. They can also help you deduplicate installs by user so that a user isn't counted as duplicate new installs. Contact your Adjust representative to get started with external device IDs. + +You can use an external device ID as a custom identifier for a device. This helps you keep continuity with your other systems. You can set property calling the `setExternalDeviceId` method with the following parameter: + +{% deflist %} +`externalDeviceId` (`std::string`) + +: Your external device identifier. This value is **case sensitive**. If you have imported external device IDs, make sure the value you pass matches the imported value. +{% /deflist %} + +```cpp +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setExternalDeviceId("{% $variables.config.externalDeviceId %}"); +Adjust2dx::initSdk(adjustConfig); +``` + +If you want to use the external device ID in your business analytics, you can pass it as a [session callback parameter](/en/sdk/cocos2dx/features/session-parameters). + +You can import existing external device IDs into Adjust. This ensures that the Adjust servers match future data to your existing device records. Contact your Adjust representative for more information. + +### Set default link token {% #set-default-link-token %} + +You can configure a default link token if your app is preinstalled on a device. When a user opens the preinstalled app for the first time, the install is attributed to the default link token. To set your default link token, call the `setDefaultTracker` method of your `AdjustConfig2dx` instance with the following argument: + +{% deflist %} +`defaultTracker` (`std::string`) + +: The [Adjust link token](https://help.adjust.com/en/article/links#adjust-link-token) you want to record preinstalled installs against. +{% /deflist %} + +```cpp +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setDefaultTracker("{% $variables.config.defaultLink %}"); +Adjust2dx::initSdk(config); +``` + +### Receive ad spend data in attribution {% #receive-ad-spend-data %} + +By default, the Adjust SDK doesn't send ad spend data as part of a user's attribution. You can configure the SDK to send this data by enabling cost data sending. To enable ad spend data sending, call the `enableCostDataInAttribution()` method of your `AdjustConfig2dx` instance. + +Cost data is accessible in the user's [attribution information](/en/sdk/cocos2dx/features/attribution). + +```cpp +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.enableCostDataInAttribution(); +Adjust2dx::initSdk(config); +``` + +### Enable background recording {% #enable-background-recording %} + +By default, the Adjust SDK pauses the sending of requests when your app is running in the background. You can configure the SDK to send requests in the background by enabling the background recording. To enable background recording, call the `enableSendingInBackground` method of your `AdjustConfig2dx` instance. + +```cpp +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.enableSendingInBackground(); +Adjust2dx::initSdk(adjustConfig); +``` + +## Dynamic configuration {% #dynamic-configuration %} + +**Dynamic** configuration options may be changed during the SDK's lifecycle in response to events or actions taken by the user. + +### Activate offline mode {% #activate-offline-mode %} + +{% callout type="important" %} +The offline mode setting isn't remembered between sessions. Offline mode is disabled at the start of each new session. +{% /callout %} + +The Adjust SDK sends event and session data to Adjust's servers in real time. You can pause the sending of information by putting the SDK in offline mode. In offline mode the SDK stores all data in a local file on the device. The SDK sends this information to Adjust's servers when you disable offline mode. + +You can toggle offline mode at any time by calling the `Adjust2dx::switchToOfflineMode` method. + +```cpp +Adjust2dx::switchToOfflineMode(); +``` + +### Deactivate offline mode {% #deactivate-offline-mode %} + +You can re-enable the SDK by calling the `Adjust2dx::switchBackToOnlineMode` method. This prompts the SDK to resume sending information. + +```cpp +Adjust2dx::switchBackToOnlineMode(); +``` + +### Set push tokens {% #set-push-tokens %} + +Push tokens are used for [Audiences](https://help.adjust.com/en/article/audiences) and client callbacks. They're also required for [Uninstall and reinstall measurement](https://help.adjust.com/en/article/uninstalls-reinstalls). + +You can update your push token at any time by calling the `Adjust2dx::setPushToken` method with the following argument: + +{% deflist %} +`pushtoken` (`std::string`) + +: Your push token. +{% /deflist %} + +```cpp +Adjust2dx::setPushToken("push-token"); +``` + +### Disable the SDK {% #disable-the-sdk %} + +The Adjust SDK runs by default when your app is open. You can disable the Adjust SDK to stop sending information to Adjust by calling the `Adjust2dx::disable` method. When you disable the Adjust SDK, no data is sent to Adjust and no information is recorded by the SDK. This means that any Adjust method called when the SDK is disabled won't record anything. + +```cpp +Adjust2dx::disable(); +``` + +### Enable the SDK {% #enable-the-sdk %} + +If you've disable the SDK and want to re-enable it, call the `Adjust2dx::enable` method. When the SDK is enabled, it will send information to Adjust's servers. + +```cpp +Adjust2dx::enable(); +``` + +#### Check enabled status {% #check-enabled-status %} + +You can check if the Adjust SDK is enabled at any time by calling the `Adjust2dx::isEnabled` method and passing a callback function. The status is returned asynchronously and passed to your callback function as a `bool` value. + +```cpp +Adjust2dx::isEnabled([](bool isEnabled) { + // process isEnabled +}); +``` diff --git a/src/content/docs/sdk/cocos2dx/v5/features/ad-revenue.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/ad-revenue.mdoc new file mode 100644 index 000000000..7968606d0 --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/ad-revenue.mdoc @@ -0,0 +1,206 @@ +--- +title: Send ad revenue information +description: Send ad revenue information for supported network partners using the Adjust SDK. +slug: en/sdk/cocos2dx/features/ad-revenue +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/features/ad-revenue +--- + +{% callout type="important" %} +You need to perform some extra setup steps in your Adjust dashboard to measure ad revenue. Contact your Technical Account Manager or support@adjust.com to get started. +{% /callout %} + +You can use the Adjust SDK to send ad revenue information from [supported network partners](https://help.adjust.com/en/article/ad-revenue) to Adjust. + +## Instantiate an ad revenue object {% #instantiate-an-ad-revenue-object %} + +To send ad revenue information with the Adjust SDK, you need to instantiate an `AdjustAdRevenue2dx` object. This object contains variables that are sent to Adjust when ad revenue is recorded in your app. + +To instantiate an ad revenue object, instantiate an `AdjustAdRevenue2dx` objec with the following parameter: + +{% deflist %} +`source` (`std::string`) + +: The source of the ad revenue. See the table below for all available sources. +{% /deflist %} + +| Parameter | Source | +| ------------------------- | ------------------------- | +| `"applovin_max_sdk"` | AppLovin MAX | +| `"admob_sdk"` | AdMob | +| `"ironsource_sdk"` | ironSource | +| `"admost_sdk"` | AdMost | +| `"unity_sdk"` | Unity | +| `"helium_chartboost_sdk"` | Helium Chartboost | +| `"adx_sdk"` | Ad(X) | +| `"tradplus_sdk"` | TradPlus | +| `"topon_sdk"` | TopOn | +| `"publisher_sdk"` | Generic source | + +Once you've instantiated your ad revenue object, set the ad revenue amount by calling the `setRevenue` method with the following arguments: + +{% deflist %} +`amount` (`double`) + +: The amount of ad revenue to be recorded. + +`currency` (`std::string`) + +: The currency of the ad revenue. You MUST format this as a 3 character [ISO 4217 code](https://www.iban.com/currency-codes) +{% /deflist %} + +```cpp +AdjustAdRevenue2dx adjustAdRevenue = AdjustAdRevenue2dx("applovin_max_sdk"); +adjustAdRevenue.setRevenue(1.00, "EUR"); +Adjust2dx::trackAdRevenue(adjustAdRevenue); +``` + +## Set additional properties {% #set-additional-properties %} + +To provide more information about ad revenue, you can set any of the following properties on your `AdjustAdRevenue2dx` instance. + +### Ad campaign details {% #ad-campaign-details %} + +You can provide additional details about the campaign associated with your `AdjustAdRevenue2dx` instance by populating various properties. This information is available in Datascape reports and raw data exports. + +#### Ad impressions + +To send the number of recorded ad impressions, call the `setAdImpressionsCount` method of your `AdjustAdRevenue2dx` instance with the following argument: + +{% deflist %} +`setAdImpressionsCount` (`int`) + +: The number of ad impressions. +{% /deflist %} + +```cpp +AdjustAdRevenue2dx adjustAdRevenue = AdjustAdRevenue2dx("{% $variables.adRevenue.source %}"); +adjustAdRevenue.setAdImpressionsCount({% $variables.adRevenue.adImpressionsCount %}); +Adjust2dx::trackAdRevenue(adjustAdRevenue); +``` + +#### Ad revenue network + +To send the network associated with ad revenue, call the `setAdRevenueNetwork` method of your `AdjustAdRevenue2dx` instance with the following argument: + +{% deflist %} +`adRevenueNetwork` (`std::string`) + +: The name of the network associated with the ad revenue. +{% /deflist %} + +```cpp +AdjustAdRevenue2dx adjustAdRevenue = AdjustAdRevenue2dx("{% $variables.adRevenue.source %}"); +adjustAdRevenue.setAdRevenueNetwork("{% $variables.adRevenue.adRevenueNetwork %}"); +Adjust2dx::trackAdRevenue(adjustAdRevenue); +``` + +#### Ad revenue unit + +To send the advertising unit that earned the revenue, call the `setAdRevenueUnit` method of your `AdjustAdRevenue2dx instance with the following argument: + +{% deflist %} +`adRevenueUnit` (`std::string`) + +: The name of the ad unit associated with the ad revenue. +{% /deflist %} + +```cpp +AdjustAdRevenue2dx adjustAdRevenue = AdjustAdRevenue2dx("{% $variables.adRevenue.source %}"); +adjustAdRevenue.setAdRevenueUnit("{% $variables.adRevenue.adRevenueUnit %}"); +Adjust2dx::trackAdRevenue(adjustAdRevenue); +``` + +#### Ad revenue placement + +To send the placement of the ad unit, call the `setAdRevenuePlacement` method with the following argument: + +{% deflist %} +`adRevenuePlacement` (`std::string`) + +: The placement of the ad unit. +{% /deflist %} + +```cpp +AdjustAdRevenue2dx adjustAdRevenue = AdjustAdRevenue2dx("{% $variables.adRevenue.source %}"); +adjustAdRevenue.setAdRevenuePlacement("{% $variables.adRevenue.adRevenuePlacement %}"); +Adjust2dx::trackAdRevenue(adjustAdRevenue); +``` + +### Callback parameters {% #callback-parameters %} + +If you [register a callback URL](https://help.adjust.com/en/article/recommended-placeholders-callbacks) in the Adjust dashboard, the SDK sends a `GET` request to your callback URL when it records an event. + +You can configure callback parameters to your servers. Once you configure parameters on an event, the SDK appends them to your [callback URL](https://help.adjust.com/en/article/raw-data-exports). You can use this information to analyze your users' in-app behavior with your BI system. + +Add callback parameters to your event by calling the `addCallbackParameter` method with `std::string` key-value arguments. You can add multiple parameters by calling this method multiple times. + +The Adjust SDK measures the event and sends a request to your URL with the callback parameters. For example, if you register the URL `https://www.mydomain.com/callback`, your callback looks like this: + +{% codeblock highlight="key=value, foo=bar" %} +```http +https://www.mydomain.com/callback?key=value&foo=bar +``` +{% /codeblock %} + +{% callout type="note" %} +Adjust doesn't store your custom callback parameters. Custom parameters are only appended to your callback URL. +{% /callout %} + +If you are using CSV uploads, make sure to add the parameters to your CSV definition. + +Adjust supports many placeholders which you can use to pass information from the SDK to your URL. For example, the `{idfa}` placeholder for iOS and the `{gps_adid}` placeholder for Android. The `{publisher_parameter}` placeholder presents all callback parameters in a single string. + +{% callout type="seealso" %} +You can read more about using URL callbacks, including a full list of available values, in the [callbacks guide](https://help.adjust.com/en/article/callbacks). +{% /callout %} + +```cpp +AdjustAdRevenue2dx adjustAdRevenue = AdjustAdRevenue2dx("{% $variables.adRevenue.source %}"); +adjustAdRevenue.addCallbackParameter({% $variables.adRevenue.callbackParams[0] %}); +adjustAdRevenue.addCallbackParameter({% $variables.adRevenue.callbackParams[1] %}); +Adjust2dx::trackAdRevenue(adjustAdRevenue); +``` + +### Partner parameters {% #partner-parameters %} + +You can send extra information to your network partners by adding [partner parameters](https://help.adjust.com/en/article/data-sharing-ad-network#map-parameters). + +Adjust sends partner parameters to [external partners](https://help.adjust.com/en/article/integrated-partners) you have set up. This information is useful for more granular analysis and retargeting purposes. Adjust's servers forward these parameters once you have set them up and enabled them for a partner. + +{% callout type="note" %} +Partner parameters don't appear in raw data by default. You can add the `{partner_parameters}` placeholder to receive them as a single string. +{% /callout %} + +Add partner parameters to your event by calling the `addPartnerParameter` method with `std::string` key-value arguments. You can add multiple parameters by calling this method multiple times. + +```cpp +AdjustAdRevenue2dx adjustAdRevenue = AdjustAdRevenue2dx({% $variables.adRevenue.source %}); +adjustAdRevenue.addPartnerParameter({% $variables.adRevenue.partnerParams[0] %}); +adjustAdRevenue.addPartnerParameter({% $variables.adRevenue.partnerParams[1] %}); +Adjust2dx::trackAdRevenue(adjustAdRevenue); +``` + +## Send ad revenue {% #send-ad-revenue %} + +Once you've populated your `AdjustAdRevenue2dx` instance, pass it as an argument to the `Adjust2dx::trackAdRevenue` to send the ad revenue information to Adjust. + +```cpp +AdjustAdRevenue2dx adjustAdRevenue = AdjustAdRevenue2dx("{% $variables.adRevenue.source %}"); +adjustAdRevenue.setRevenue({% $variables.adRevenue.revenue.amount %}, "{% $variables.adRevenue.revenue.currency %}"); +adjustAdRevenue.setAdImpressionsCount({% $variables.adRevenue.adImpressionsCount %}); +adjustAdRevenue.setAdRevenueNetwork("{% $variables.adRevenue.adRevenueNetwork %}"); +adjustAdRevenue.setAdRevenueUnit("{% $variables.adRevenue.adRevenueUnit %}"); +adjustAdRevenue.setAdRevenuePlacement("{% $variables.adRevenue.adRevenuePlacement %}"); +adjustAdRevenue.addCallbackParameter({% $variables.adRevenue.callbackParams[0] %}); +adjustAdRevenue.addCallbackParameter({% $variables.adRevenue.callbackParams[1] %}); +adjustAdRevenue.addPartnerParameter({% $variables.adRevenue.partnerParams[0] %}); +adjustAdRevenue.addPartnerParameter({% $variables.adRevenue.partnerParams[1] %}) +Adjust2dx::trackAdRevenue(adjustAdRevenue); +``` diff --git a/src/content/docs/sdk/cocos2dx/v5/features/att.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/att.mdoc new file mode 100644 index 000000000..eb5b91cf0 --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/att.mdoc @@ -0,0 +1,77 @@ +--- +title: Set up App Tracking Transparency +description: Configure your app to use Apple's App Tracking Transparency framework +slug: en/sdk/cocos2dx/features/att +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/features/att +--- + +If you want to record the device's ID for Advertisers (IDFA), you must display a prompt to get your user's authorization. To do this, you need to include Apple's App Tracking Transparency (ATT) framework in your app. The Adjust SDK stores the user's authorization status and sends it to Adjust's servers with each request. + +## Authorization statuses {% #authorization-statuses %} + +| Status | Code | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `ATTrackingManagerAuthorizationStatusNotDetermined` | `0` | The user hasn't responded to the access prompt yet | +| `ATTrackingManagerAuthorizationStatusRestricted` | `1` | Access to app-related data is blocked at the device level | +| `ATTrackingManagerAuthorizationStatusDenied` | `2` | The user has denied access to app-related data for device measurement | +| `ATTrackingManagerAuthorizationStatusAuthorized` | `3` | The user has approved access to app-related data for device measurement | + +If the SDK is unable to retrieve the ATT status, it returns a value of `-1`. + +## Show consent prompt {% #show-consent-prompt %} + +The Adjust SDK contains a wrapper around [Apple's `requestTrackingAuthorizationWithCompletionHandler` method](https://developer.apple.com/documentation/apptrackingtransparency/attrackingmanager/3547037-requesttrackingauthorizationwith). You can use this wrapper if you don't want to customize the ATT prompt. + +The callback method triggers when your user responds to the consent dialog. This method sends the user's consent status code to Adjust's servers. You can define responses to each status code within the callback function. + +You must specify text content for the tracking request dialog. To do this, add your text to the `NSUserTrackingUsageDescription` key in your `Info.plist` file. + +{% callout type="tip" %} +The Adjust SDK also records the consent status if you use a custom prompt. If you show your prompt before initialization, the SDK sends the status with the install event. If you show it after initialization, the SDK sends the status to Adjust's servers as soon as the user updates it. +{% /callout %} + +```cpp +Adjust2dx::requestAppTrackingAuthorization([] (int status) { + switch (status) { + case 0: + // ATTrackingManagerAuthorizationStatusNotDetermined case + break; + case 1: + // ATTrackingManagerAuthorizationStatusRestricted case + break; + case 2: + // ATTrackingManagerAuthorizationStatusDenied case + break; + case 3: + // ATTrackingManagerAuthorizationStatusAuthorized case + break; + } +}); +``` + +## Customize prompt timing {% #customize-prompt-timing %} + +If your app includes an onboarding process or a tutorial, you may want to delay sending your user's ATT consent status until after the user has completed this process. To do this, you can call the `setAttConsentWaitingInterval` method on your `AdjustConfig2dx` instance to delay the sending of data for **up to 360 seconds** to give the user time to complete the initial onboarding. After the timeout ends or the user sets their consent status, the SDK sends all information it has recorded during the delay to Adjust's servers along with the user's consent status. + +If the user closes the app before the timeout ends, or before they select their consent status, the timeout restarts when they reopen the app. + +```cpp +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setAttConsentWaitingInterval({% $variables.config.attWaitingInterval %}); +Adjust2dx::initSdk(adjustConfig); +``` + +## Get current authorization status {% #get-current-authorization-status %} + +You can retrieve a user's current authorization status at any time. Call the `Adjust2dx::getAppTrackingAuthorizationStatus()` method to return the authorization status code as an `int`. + +```cpp +Adjust2dx::getAppTrackingAuthorizationStatus(); +``` diff --git a/src/content/docs/sdk/cocos2dx/v5/features/attribution.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/attribution.mdoc new file mode 100644 index 000000000..102fdfeec --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/attribution.mdoc @@ -0,0 +1,64 @@ +--- +title: Get attribution information +description: Listen for attribution changes using the Adjust SDK +slug: en/sdk/cocos2dx/features/attribution +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/features/attribution +--- + +When a user interacts with an Adjust link, their attribution information updates. This can happen if the user interacts with a [deep link](https://help.adjust.com/en/article/deep-links). Information about a user's attribution is represented in the `AdjustAttribution2dx` class. + +## AdjustAttribution2dx class properties {% #class-properties %} + +The `AdjustAttribution2dx` class contains details about the current attribution status of the device. Any values that aren't populated for the user are returned as a `std::string` value. + +{% callout type="note" %} +The following values can only be accessed if you have [called the `enableCostDataInAttribution` method on your `AdjustConfig2dx` instance](/en/sdk/cocos2dx/configuration#receive-ad-spend-data): + +- `costType` +- `costAmount` +- `costCurrency` +{% /callout %} + +| Values | Data type | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `trackerToken` | `std::string` | The token of the tracker to which the device is currently attributed | +| `trackerName` | `std::string` | The name of the tracker to which the device is currently attributed | +| `network` | `std::string` | The name of the network to which the device is currently attributed | +| `campaign` | `std::string` | The name of the campaign to which the device is currently attributed | +| `adgroup` | `std::string` | The name of the adgroup to which the device is currently attributed | +| `creative` | `std::string` | The name of the creative to which the device is currently attributed | +| `clickLabel` | `std::string` | The [click label](https://help.adjust.com/en/article/user-rewards) that the install is tagged with | +| `costType` | `std::string` | The campaign pricing model (for example cpi) | +| `costAmount` | `double` | The cost of the install. | +| `costCurrency` | `std::string` | The [3 character ISO 4217 code](https://www.iban.com/currency-codes) of the currency associated with the cost. | +| `fbInstallReferrer` | `std::string` | The [Facebook install referrer](https://developers.facebook.com/docs/app-ads/install-referrer/). | + +## Configure an attribution callback function {% #configure-an-attribution-callback-function %} + +You can configure the Adjust SDK to call a function whenever a user's attribution information updates by passing the function to the `setAttributionCallback` method on your `AdjustConfig2dx` instance. The SDK calls this function with an `AdjustAttribution2dx` object as its argument. + +```cpp +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setLogLevel(AdjustLogLevel2dxVerbose); +adjustConfig.setAttributionCallback([](AdjustAttribution2dx attribution) { + // process attribution +}); +Adjust2dx::initSdk(adjustConfig); +``` + +## Get current attribution information {% #get-current-attribution-information %} + +When a user installs your app, Adjust attributes the install to a campaign. The Adjust SDK gives you access to campaign attribution details for your install. To return this information as an `AdjustAttribution2dx` object, call the `Adjust2dx::getAttribution` method. + +```cpp +Adjust2dx::getAttribution([](AdjustAttribution2dx attribution) { + // process attribution +}); +``` diff --git a/src/content/docs/sdk/cocos2dx/v5/features/callbacks.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/callbacks.mdoc new file mode 100644 index 000000000..9281d5cee --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/callbacks.mdoc @@ -0,0 +1,109 @@ +--- +title: Send callback information +description: Use these methods to send callback information to Adjust. +slug: en/sdk/cocos2dx/features/callbacks +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/features/callbacks +--- + +Configure callbacks to call functions when the SDK sends information to Adjust. You can configure callbacks for **sessions** and **events**. + +## Session callbacks {% #session-callbacks %} + +Configure session callbacks to call functions when the SDK sends session information. You can configure **success** callbacks and **failure** callbacks. **Success** callbacks are called when the SDK sends information to Adjust's servers. **Failure** callbacks are called when the SDK encounters a problem while sending the information. + +Session callbacks have access to a response data object. You can use its properties in your callback function. + +| Property | Type | Description | +| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `message` | `std::string` | The message from the server or the error logged by the SDK. | +| `timestamp` | `std::string` | The timestamp from Adjust's servers. | +| `adid` | `std::string` | A unique device identifier provided by Adjust. | +| `jsonResponse` | `std::string` | The JSON object with the response from the server. | +| `willRetry` | `bool` | Indicates whether there will be an attempt to resend a failed package. Available only on failure callbacks. | + +### Success callbacks {% #session-success-callbacks %} + +Configure a success callback to call a function when the SDK records a session. + +```cpp +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setLogLevel(AdjustLogLevel2dxVerbose); +adjustConfig.setSessionSuccessCallback([](AdjustSessionSuccess2dx adjustSessionSuccess) { + // process adjustSessionSuccess +}); +Adjust2dx::initSdk(adjustConfig); +``` + +### Failure callbacks {% #session-failure-callbacks %} + +Configure a failure callback to call a function when the SDK fails to record a session. + +```cpp +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setLogLevel(AdjustLogLevel2dxVerbose); +adjustConfig.setSessionFailureCallback([](AdjustSessionFailure2dx adjustSessionFailure) { + // process adjustSessionFailure +}); +Adjust2dx::initSdk(adjustConfig); +``` + +## Event callbacks {% #event-callbacks %} + +Configure event callbacks to call a function when the SDK sends event information. You can configure **success** callbacks and **failure** callbacks. **Success** callbacks are called when the SDK sends information to Adjust's servers. **Failure** callbacks are called when the SDK encounters a problem while sending the information. + +Event callbacks have access to a response data object. You can use its properties in your callback function. + +| Property | Type | Description | +| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `message` | `std::string` | The message from the server or the error logged by the SDK. | +| `timestamp` | `std::string` | The timestamp from Adjust's servers. | +| `adid` | `std::string` | A unique device identifier provided by Adjust. | +| `eventToken` | `std::string` | The event token | +| `callbackId` | `std::string` | The custom callback ID set on the event object | +| `jsonResponse` | `std::string` | The JSON object with the response from the server. | +| `willRetry` | `bool` | Indicates whether there will be an attempt to resend a failed package. Only available on failure callbacks. | + +### Success callbacks {% #event-success-callbacks %} + +Configure a success callback to call a function when the SDK records an event. + +```cpp +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setLogLevel(AdjustLogLevel2dxVerbose); +adjustConfig.setEventSuccessCallback([](AdjustEventSuccess2dx adjustEventSuccess) { + // process adjustEventSuccess +}); +Adjust2dx::initSdk(adjustConfig); +``` + +### Failure callbacks {% #event-failure-callbacks %} + +Configure a failure callback to call a function when the SDK fails to record an event. + +```cpp +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setLogLevel(AdjustLogLevel2dxVerbose); +adjustConfig.setEventFailureCallback([](AdjustEventFailure2dx adjustEventFailure) { + // process adjustEventFailure +}); +Adjust2dx::initSdk(adjustConfig); +``` diff --git a/src/content/docs/sdk/cocos2dx/v5/features/deep-links.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/deep-links.mdoc new file mode 100644 index 000000000..89d96b3d4 --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/deep-links.mdoc @@ -0,0 +1,89 @@ +--- +title: Deep linking +description: Follow the guides in this section to set up deep linking. +category-title: Deep linking +slug: en/sdk/cocos2dx/features/deep-links +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/features/deep-links +--- + +You can create deep links to take users to specific pages in your app. The Adjust SDK uses different logic depending on if the user already has your app installed on their device: + +- Direct deep linking: occurs if the user already has your app installed. The link takes the user to the page specified in the link +- Deferred deep linking: occurs if the user doesn't have your app installed. The link takes the user to a storefront to install your app first. After the user installs the app, it opens to the page specified in the link. + +The SDK can read deep link data after a user opens your app from a link. + +## Direct deep linking {% #direct-deep-linking %} + +Direct deep linking MUST be set up at the platform level. It isn't possible to configure direct deep linking in your Cocos2d-x C++ code. + +Follow the instructions for setting up deep linking for your target platform: + +- [iOS](/en/sdk/ios/features/deep-links/direct) +- [Android](/en/sdk/android/features/deep-links) + +## Deferred deep link callbacks {% #deferred-deep-link-callbacks %} + +You can configure the Adjust SDK to call a callback function when it receives a deferred deep link. This callback function receives the deep link as a `string` argument. + +```cpp +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setLogLevel(AdjustLogLevel2dxVerbose); +adjustConfig.setDeferredDeeplinkCallback([](std::string adjustDeeplink) { + // process adjustDeeplink +}); +Adjust2dx::initSdk(adjustConfig); +``` + +## Reattribution via deep links {% #reattribution-via-deep-links %} + +Adjust enables you to run re-engagement campaigns using deep links. For more information, check out how to set up [Deep links in Campaign Lab](https://help.adjust.com/en/article/deep-links). + +To reattribute your user, you need to instantiatee an `AdjustDeeplink2dx` object with the deep link URL and pass it to the `Adjust2dx::processDeeplink` method. The Adjust SDK then looks for new attribution data within the deep link. If the SDK finds new information, it forwards the information to Adjust’s servers for reattribution. + +```cpp +AdjustDeeplink2dx adjustDeeplink = AdjustDeeplink2dx("url"); +Adjust2dx::processDeeplink(adjustDeeplink); +``` + +## Enable LinkMe {% #enable-linkme %} + +The Adjust SDK lets you copy deep link information from the device pasteboard. When combined with [Adjust’s LinkMe solution](https://help.adjust.com/en/article/linkme), this feature enables deferred deep linking on devices running iOS 15 and above. + +{% callout type="important" %} +The Adjust SDK checks the pasteboard when a user opens the app for the first time. The device displays a dialog asking if the user wants to allow the app to read the pasteboard. +{% /callout %} + +When a user clicks on a LinkMe URL they have the option to copy the link information to their system pasteboard. You can use the Adjust SDK to read the system pasteboard for deep link information. If deep link information is present, the SDK forwards the user to the correct page in your app. + +To enable pasteboard checking in your app, call the `enableLinkMe` method on your `AdjustConfig2dx` instance. + +```cpp +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setLogLevel(AdjustLogLevel2dxVerbose); +adjustConfig.enableLinkMe(); +Adjust2dx::initSdk(adjustConfig) +``` + +## Get the last processed link {% #get-the-last-processed-link %} + +You can return the last deep link URL resolved by the `Adjust2sx::processDeeplink` or `Adjust2dx::processAndResolveDeepLink` method by calling the `Adjust2dx::getLastDeeplink` method. This method returns the last processed deep link as a deep link object. + +```cpp +Adjust2dx::getLastDeeplink([](std::string lastDeeplink) { + std::cout << "\nLast deeplink = " << lastDeeplink; +}); +``` diff --git a/src/content/docs/sdk/cocos2dx/v5/features/device-info.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/device-info.mdoc new file mode 100644 index 000000000..4b2539c0c --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/device-info.mdoc @@ -0,0 +1,79 @@ +--- +title: Get device information +description: Use these methods to add details to your callbacks and improve your reporting. +slug: en/sdk/cocos2dx/features/device-info +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/features/device-info +--- + +The Adjust SDK contains helper methods that return device information. Use these methods to add details to your callbacks and improve your reporting. + +## Adjust device identifier {% #adid %} + +Adjust generates a unique Adjust Device ID (ADID) for each device. Call the `getAdid` method to asynchronously return the ADID as a `std::string` to a delegate function. + +```cpp +Adjust2dx::getAdid([](std::string adId) { + std::cout << "\nAdjust ID = " << adid; +}); +``` + +## ID For Advertisers {% #idfa %} + +The ID for Advertisers (IDFA) is a device-specific identifier for Apple devices. Call the `getIdfa` method to asynchronously return the IDFA as a `std::string` to a delegate function. + +```cpp +Adjust2dx::getIdfa([](std::string idfa) { + std::cout << "\nIDFA = " << idfa; +}); +``` + +## ID For Vendor {% #idfv %} + +The ID for Vendor (IDFV) is a device-specific identifier for Apple devices. Call the `getIdfv` method to asynchronously return the IDFV as a `std::string` to a delegate function. + +```cpp +Adjust2dx::getIdfv([](std::string idfv) { + std::cout << "\nIDFV = " << idfa; +}); +``` + +## Google Play Services Advertising ID {% #google-adid %} + +The Google Play Services Advertising ID (GPS ADID) is a device-specific identifier for Android devices. + +Users can opt out of sharing their GPS ADID by toggling the "Opt out of Ads Personalization" setting on their device. When a user enables this setting, the Adjust SDK returns a string of zeros when trying to read the GPS ADID. + +You can access this value by calling the `getGoogleAdId` method in a background thread. Assign a delegate function to access the GPS ADID value. + +```cpp +Adjust2dx::getGoogleAdId([](std::string googleAdId) { + std::cout << "\nGoogle Ad ID = " << googleAdId; +}); +``` + +## Amazon Advertiser ID {% #amazon-adid %} + +The Amazon Advertising ID (Amazon Ad ID) is a device-specific identifier for Android devices. Call the `getAmazonAdId` method to asynchronously return the Amazon Ad ID as a `std::string` to a delegate function. + +```cpp +Adjust2dx::getAmazonAdId([](std::string amazonAdId) { + std::cout << "\nAmazon Ad ID = " << amazonAdId; +}); +``` + +## Adjust SDK version {% #sdk-version-getter %} + +To read the version of the Adjust SDK, pass a callback function to the `getSdkVersion` method. The SDK fetches the information asynchronously and passes it to your callback function. + +```cpp +Adjust2dx::getSdkVersion([](std::string sdkVersion) { + std::cout << "\nSDK version = " << sdkVersion; +}); +``` diff --git a/src/content/docs/sdk/cocos2dx/v5/features/events.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/events.mdoc new file mode 100644 index 000000000..a8d38ee8c --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/events.mdoc @@ -0,0 +1,244 @@ +--- +title: Send event information +description: Use these methods to send event information to Adjust. +slug: en/sdk/cocos2dx/features/events +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/features/events +--- + +You can use the Adjust SDK to send event information to Adjust's servers in response to actions taken by your users. Adjust records these events and surfaces them in your [Datascape reports](https://help.adjust.com/en/article/datascape), [server callbacks](https://help.adjust.com/en/article/server-callbacks), and [cloud storage uploads](https://help.adjust.com/en/article/cloud-storage-uploads). + +For more information on configuring events in Adjust, see the [Add events guide](https://help.adjust.com/en/article/add-events) in the Help Center. + +## How it works {% #how-it-works %} + +Events are represented by `AdjustEvent2dx` instances. The `AdjustEvent2dx` class contains properties which you can populate with event information to send to Adjust. The `AdjustEvent2dx` class MUST be instantiated using an Adjust event token. You can find your event token in AppView by following the steps in the [Add events guide](https://help.adjust.com/en/article/add-events#copy-event-token). You can set each property to create a complete representation of your event. + +Once you've set all the properties you need to set, use the `Adjust2dx::trackEvent()` method to send the `AdjustEvent2dx` instance to Adjust. When Adjust receives this object, it records the event information for you to report on. + +## Reference {% #reference %} + +The `AdjustEvent2dx` class is used to hold information about an event. Each event is represented by a unique `AdjustEvent2dx` instance. + +### Constructor {% #constructor %} + +Instantiate an `AdjustEvent2dx` object by passing your event token as an argument. + +{% deflist %} +`eventToken` (`std::string`) + +: Your Adjust event token. See [Add events](https://help.adjust.com/en/article/add-events#manage-your-events) for more information. +{% /deflist %} + +```cpp +AdjustEvent2dx adjustEvent = AdjustEvent2dx("{% $variables.event.token %}"); +Adjust2dx::trackEvent(adjustEvent); +``` + +### Set event revenue {% #set-event-revenue %} + +Set the revenue amount and currency code of any revenue associated with the event by calling the `setRevenue()` method. + +{% deflist %} +`revenue` (`double`) + +: The amount of revenue generated by the event. + +`currency` (`std::string`) + +: The [ISO 4217 code](https://www.iban.com/currency-codes) of the event currency. +{% /deflist %} + +```cpp +AdjustEvent2dx adjustEvent = AdjustEvent2dx("{% $variables.event.token %}"); +adjustEvent.setRevenue({% $variables.event.revenue.amount %}, "{% $variables.event.revenue.currency %}"); +Adjust2dx::trackEvent(adjustEvent); +``` + +### Add callback parameters {% #add-callback-parameters %} + +Add callback parameters by passing `std::string` key-value pairs to the `addCallbackParameter` method. When Adjust receives your `AdjustEvent2dx` instance, all callback parameters are sent to your callback URL. + +{% deflist %} +`key` (`std::string`) + +: The name (key) of the parameter. + +`value` (`std::string`) + +: The value of the parameter. +{% /deflist %} + +```cpp +AdjustEvent2dx adjustEvent = AdjustEvent2dx("{% $variables.event.token %}"); +adjustEvent.addCallbackParameter({% $variables.event.callbackParams[0] %}); +adjustEvent.addCallbackParameter({% $variables.event.callbackParams[1] %}); +Adjust2dx::trackEvent(adjustEvent); +``` + +### Add partner parameters {% #add-partner-parameters %} + +Add callback parameters by passing `string` key-value pairs to the `addPartnerParameter()` method. When Adjust receives your `AdjustEvent2dx` instance, all partner parameters are sent to any external partners you've configured. + +{% deflist %} +`key` (`std::string`) + +: The name (key) of the parameter. + +`value` (`std::string`) + +: The value of the parameter. +{% /deflist %} + +```cpp +AdjustEvent2dx adjustEvent = AdjustEvent2dx("{% $variables.event.token %}"); +adjustEvent.addPartnerParameter({% $variables.event.partnerParams[0] %}); +adjustEvent.addPartnerParameter({% $variables.event.partnerParams[1] %}); +Adjust2dx::trackEvent(adjustEvent) +``` + +### Set deduplication ID {% #set-deduplication-id %} + +Sets a unique identifier for the `AdjustEvent2dx` instance to deduplicate revenue events by calling the `setDeduplicationId()` method. The SDK stores the last ten identifiers and skips revenue events with duplicate transaction IDs. + +{% deflist %} +`deduplicationId` (`std::string`) + +: A unique deduplication ID. +{% /deflist %} + +```cpp +AdjustEvent2dx adjustEvent = AdjustEvent2dx("{% $variables.event.token %}"); +adjustEvent.setDeduplicationId("{% $variables.event.deduplicationId %}"); +Adjust2dx::trackEvent(adjustEvent); +``` + +### Set a callback ID {% #set-callback-id %} + +Sets a unique identifier for Adjust's servers to report on in event callback by calling the `setCallbackId` method. + +{% deflist %} +`callbackId` (`std::string`) + +: A unique callback ID. +{% /deflist %} + +```cpp +AdjustEvent2dx adjustEvent = AdjustEvent2dx("{% $variables.event.token %}"); +adjustEvent.setCallbackId("{% $variables.event.callbackId %}"); +Adjust2dx::trackEvent(adjustEvent); +``` + +### Send an event {% #send-an-event %} + +Call the `Adjust2dx::trackEvent` method with your `AdjustEvent2dx` instance as an argument to send your event to Adjust. + +{% deflist %} +`adjustEvent` (`AdjustEvent2dx`) + +: Your `AdjustEvent2dx` instance. +{% /deflist %} + +```cpp +AdjustEvent2dx adjustEvent = AdjustEvent2dx("{% $variables.event.token %}"); +Adjust2dx::trackEvent(adjustEvent); +``` + +## Tutorial {% #tutorial %} + +This tutorial demonstrates how to use the `AdjustEvent2dx` class to send event information to Adjust. You will learn: + +1. How to create create and populate an `AdjustEvent2dx` instance. +1. How to use the `AdjustEvent2dx` class in your app to send event information to Adjust. + +To send event information to Adjust, follow these steps: + +1. Instantiate and populate an `AdjustEvent2dx` object with your Adjust event token. In the example below, the following properties are set: + - The event revenue is set to _{% $variables.event.revenue.amount %}_ and the currency code is set to _{% $variables.event.revenue.currency %}_. + - The event deduplication ID is set to _{% $variables.event.deduplicationId %}_. + - The event token and revenue amount are added as callback parameters. + - The ID of the associated product and ID of the user who triggered the event are added as partner parameters. + - The callback ID is set to _{% $variables.event.callbackId %}_. +1. At the end of your function, send the information to Adjust by calling `Adjust2dx::trackEvent()` with your `AdjustEvent2dx` instance as an argument. +1. Call your function in response to an action in your app. In the example below, the function is called when the `Send Event` button is pressed. + +```cpp +#include "Adjust/Adjust2dx.h" + +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +Adjust2dx::initSdk(adjustConfig); + +AdjustEvent2dx adjustEvent = AdjustEvent2dx("g3mfiw"); +adjustEvent.setRevenue({% $variables.event.revenue.amount %}, "{% $variables.event.revenue.currency %}"); +adjustEvent.setDeduplicationId("{% $variables.event.deduplicationId %}"); +adjustEvent.addCallbackParameter({% $variables.event.callbackParams[0] %}); +adjustEvent.addCallbackParameter({% $variables.event.callbackParams[1] %}); +adjustEvent.addPartnerParameter({% $variables.event.partnerParams[0] %}); +adjustEvent.addPartnerParameter({% $variables.event.partnerParams[1] %}); +adjustEvent.setCallbackId("{% $variables.event.callbackId %}"); +Adjust2dx::trackEvent(adjustEvent); +``` + +You will see a log output containing the details of your `AdjustEvent2dx` instance when the event is sent to Adjust. + +```txt +Path: /event +ClientSdk: cocos2dx{% $versions.cocos2dx.v5%} +Parameters: + android_uuid {% $variables.ids.android_uuid %} + api_level 34 + app_token {% $variables.config.token %} + app_version 1.0 + attribution_deeplink 1 + callback_id {% $variables.event.callbackId %} + callback_params {{% $variables.event.callbackParamsJson[0] %}, {% $variables.event.callbackParamsJson[1] %}} + connectivity_type 1 + country US + cpu_type arm64-v8a + created_at 2024-01-25T14:13:16.151Z+0100 + currency {% $variables.event.revenue.currency %} + device_manufacturer Google + device_name sdk_gphone64_arm64 + device_type phone + display_height 2205 + display_width 1080 + environment sandbox + event_buffering_enabled 0 + event_count 3 + event_token {% $variables.event.token %} + gps_adid {% $variables.ids.gps_adid %} + gps_adid_attempt 2 + gps_adid_src service + hardware_name UE1A.230829.036 + language en + mcc 310 + mnc 260 + needs_response_details 1 + os_build UE1A.230829.036 + os_name android + os_version 14 + package_name com.adjust.examples + partner_params {{% $variables.event.partnerParamsJson[0] %}, {% $variables.event.partnerParamsJson[1] %}} + revenue {% $variables.event.revenue.amount %} + screen_density high + screen_format long + screen_size normal + session_count 2 + session_length 23 + subsession_count 1 + time_spent 23 + tracking_enabled 1 + deduplication_id {% $variables.event.deduplicationId %} + ui_mode 1 +``` + +{% deflist /%} diff --git a/src/content/docs/sdk/cocos2dx/v5/features/global-parameters.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/global-parameters.mdoc new file mode 100644 index 000000000..41ebf483c --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/global-parameters.mdoc @@ -0,0 +1,81 @@ +--- +title: Configure global parameters +description: Send information to your callback URL with each session. +slug: en/sdk/cocos2dx/features/session-parameters +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/features/session-parameters +--- + +If you [register a callback URL](https://help.adjust.com/en/article/recommended-placeholders-callbacks) in the Adjust dashboard, Adjust sends a GET request to your callback URL when the SDK measures a session. + +## Global callback parameters {% #global-callback-parameters %} + +{% callout type="note" %} +The Adjust SDK merges session callback parameters with event callback parameters. Event callback parameters take priority over session callback parameters. This means that if you add a parameter key to both an event and a session, the SDK sends the event parameter. +{% /callout %} + +You can configure global callback parameters to send to your servers. The Adjust SDK appends all global callback parameters to your callback URL. You can use this information to analyze your users' in-app behavior with your BI system. + +### Add global callback parameters {% #add-global-callback-parameters %} + +Add callback parameters globally by calling the `Adjust2dx::addGlobalCallbackParameter` method with `std::string` key-value arguments. You can add multiple parameters by calling this method multiple times. + +```cpp +Adjust2dx::addGlobalCallbackParameter("foo", "bar"); +``` + +### Remove global callback parameters {% #remove-global-callback-parameters %} + +You can remove specific global callback parameters if they're no longer required. To do this, pass the parameter `key` to the `Adjust2dx::removeGlobalCallbackParameter` method. + +```cpp +Adjust2dx::removeSessionCallbackParameter("foo"); +``` + +### Reset global callback parameters {% #reset-global-callback-parameters %} + +You can remove all global parameters if they're no longer required. To do this, call the `Adjust2dx::removeGlobalCallbackParameters` method. + +```cpp +Adjust2dx::removeGlobalCallbackParameters(); +``` + +## Global partner parameters {% #global-partner-parameters %} + +You can send extra information to your network partners by adding global [partner parameters](https://help.adjust.com/en/article/data-sharing-ad-network#map-parameters). + +Adjust sends global partner parameters to [external partners](https://help.adjust.com/en/article/integrated-partners) you've set up. This information is useful for more granular analysis and retargeting purposes. Adjust's servers forward these parameters once you've set them up and enabled them for a partner. + +{% callout type="note" %} +Partner parameters don't appear in raw data exports by default. You can add the `{partner_parameters}` placeholder to receive them as a single string. +{% /callout %} + +### Add global partner parameters {% #add-global-partner-parameters %} + +Send global partner parameters by calling the `Adjust2dx::addGlobalPartnerParameter` method with `std::string` key-value arguments. You can add multiple parameters by calling this method multiple times. + +```cpp +Adjust2dx::addGlobalPartnerParameter("foo", "bar"); +``` + +### Remove global partner parameters {% #remove-global-partner-parameters %} + +You can remove specific global partner parameters if they're no longer required. To do this, pass the parameter `key` to the `Adjust2dx::removeGlobalPartnerParameter` method. + +```cpp +Adjust2dx::removeGlobalPartnerParameter("foo"); +``` + +### Reset global partner parameters {% #reset-global-partner-parameters %} + +You can remove all global partner parameters if they're no longer required. To do this, call the `Adjust2dx::removeGlobalPartnerParameters` method. + +```cpp +Adjust2dx::removeGlobalPartnerParameters(); +``` diff --git a/src/content/docs/sdk/cocos2dx/features/index.mdx b/src/content/docs/sdk/cocos2dx/v5/features/index.mdoc similarity index 65% rename from src/content/docs/sdk/cocos2dx/features/index.mdx rename to src/content/docs/sdk/cocos2dx/v5/features/index.mdoc index 8426be3e0..e96f3b137 100644 --- a/src/content/docs/sdk/cocos2dx/features/index.mdx +++ b/src/content/docs/sdk/cocos2dx/v5/features/index.mdoc @@ -5,6 +5,14 @@ category-title: Features slug: en/sdk/cocos2dx/features type: category sidebar-position: 3 +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/features --- Use the Adjust SDK to send in-app information to Adjust's servers. diff --git a/src/content/docs/sdk/cocos2dx/v5/features/preinstalled.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/preinstalled.mdoc new file mode 100644 index 000000000..e399bde2c --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/preinstalled.mdoc @@ -0,0 +1,120 @@ +--- +title: Send preinstalled app activity +description: Configure a campaign to send information from preinstalled apps. +slug: en/sdk/cocos2dx/features/preinstalled +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4 +--- + +You can use the Adjust SDK to record activity from apps that came preinstalled on a user's device. This enables you to send information from users who didn't download your app from a campaign. + +Control whether preinstall measurement is enabled by calling the `setPreinstallTrackingEnabled` method of your `AdjustConfig2dx` instance with a `bool` argument. + +```cpp +#include "Adjust/Adjust2dx.h" + +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setPreinstallTrackingEnabled(true); +Adjust2dx::initSdk(adjustConfig); +``` + +The Adjust SDK provides 5 methods for measuring preinstalled apps: + +- [System Properties](#system-properties). +- [Content provider](#content-provider). +- [System Installer Receiver](#system-installer-receiver). +- [World Readable Directory](#world-readable-directory). +- [Default link token](#default-link-token). + +## System properties {% #system-properties %} + +Original Equipment Manufacturer (OEM) partners can leverage Android system properties to attribute preinstalled apps. The OEM (Original Equipment Manufacturer) writes attribution information to a file and adds its path to the system properties. The Adjust SDK reads this file on initialization to attribute the install. + +## Content provider {% #content-provider %} + +The content provider method makes use of a read-only content provider. The SDK uses a content resolver to gather preinstall information from the request. + +To set the permissions, add the following to your `AndroidManifest.xml` file. + +```xml + +``` + +To access a list of preinstalled apps on the device, add the following to your `AndroidManifest.xml` file. + +```xml + + + + + +``` + +## System installer receiver {% #system-installer-receiver %} + +The system installer method uses a broadcast receiver. The system installer broadcasts preinstall information. The Adjust SDK reads this information using the system preinstall referrer receiver. + +To set up the receiver, add the following to your `AndroidManifest.xml` file. + +```xml + + + + + +``` + +## World-readable directory {% #world-readable-directory %} + +Save attribution information for your preinstalled app in a world-readable directory. The SDK reads the information from this file at install to attribute the user. The system encryption protocol protects app data. + +To give the Adjust SDK access to this information, call the `setPreinstallFilePath` method of your `AdjustConfig2dx` instance with the path of your file. + +```cpp +#include "Adjust/Adjust2dx.h" + +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setPreinstallFilePath("{% $variables.config.preinstallFilePath %}"); +Adjust2dx::initSdk(adjustConfig); +``` + +## Default link token {% #default-link-token %} + +Configuring a default link token enables you to attribute all preinstalls to a predefined Adjust link. Adjust records all information against this token until the attribution source changes. To set this up: + +1. [Create a new campaign link in Campaign Lab](https://help.adjust.com/en/article/links). + + ```http + https://app.adjust.com/{% $variables.config.defaultTracker %} + ``` + +1. Copy this token and assign it to the `DefaultTracker` property of your `AdjustConfig2dx` instance in your app delegate file. + + ```cpp + #include "Adjust/Adjust2dx.h" + + std::string appToken = "{% $variables.config.token %}"; + std::string environment = AdjustEnvironmentSandbox2dx; + + AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); + adjustConfig.setDefaultTracker("{% $variables.config.defaultTracker %}"); + Adjust2dx::initSdk(adjustConfig); + ``` + +1. Build and run your app. If you have logging enabled, you should see a message in your log + + ```text + Default tracker: '{% $variables.config.defaultTracker %}'. + ``` diff --git a/src/content/docs/sdk/cocos2dx/v5/features/privacy.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/privacy.mdoc new file mode 100644 index 000000000..a73b561cc --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/privacy.mdoc @@ -0,0 +1,360 @@ +--- +title: Set up privacy features +description: Configure features that you can use to handle user privacy in your app. +slug: en/sdk/cocos2dx/features/privacy +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/features/privacy +--- + +The Adjust SDK contains features that you can use to handle user privacy in your app. + +## Send right to be forgotten request {% #send-rtbf-request %} + +The EU’s General Data Protection Regulation (GDPR) and similar privacy laws worldwide (CCPA, LGPD, etc.) grant data subjects comprehensive rights when it comes to the processing of their personal data. These rights include, among others, the right to erasure (see [Art. 17 GDPR](https://gdpr.eu/article-17-right-to-be-forgotten/))([1](https://help.adjust.com/en/article/gdpr#ref-1)). As a data processor, Adjust is obliged to support you (the data controller) in the processing of such requests from your (app) users. + +You can send the user's erasure request to Adjust by calling the `Adjust2dx::gdprForgetMe()` method. Once Adjust has been notified: + +- Adjust will permanently delete all of the user’s historical personal data from its internal systems and database. +- Adjust will no longer receive data from this user/device via the Adjust SDK.([2](https://help.adjust.com/en/article/gdpr#ref-2)) + +```cpp +Adjust2dx::gdprForgetMe(); +``` + +## Set up apps for children {% #set-up-apps-for-children %} + +If your app targets the "Kids" category, you MUST prevent your app from collecting device identifiers. To do this: + +1. (Android only): Remove the `com.google.android.gms.permission.AD_ID` permission by adding the following to your `AndroidManifest.xml` file: + + ```xml + + ``` + +1. (iOS only): Ensure that you unlink the `AdSupport.framework` and `AppTrackingTransparency.framework` frameworks from your project. + +### Configure COPPA compliance {% #configure-coppa-compliance %} + +{% callout type="important" %} +See [COPPA compliance](https://help.adjust.com/en/article/coppa-compliance) in the Help Center to see if your app needs to be COPPA compliant. +{% /callout %} + +If your app falls under a category that needs to be compliant with the Children's Online Privacy Protection Act (COPPA), you MUST call the `enableCoppaCompliance` method on your `AdjustConfig2dx` instance. Calling this method does the following: + +1. Disables third-party sharing **before** the user launches their first `session`. +1. Prevents the SDK from reading device and advertising IDs (for example: `gps_adid` and `android_id`). + +```cpp +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.enableCoppaCompliance(); +Adjust2dx::initSdk(adjustConfig); +``` + +### Configure Play Store Kids Apps compliance (Android only) {% #configure-play-store-kids-compliance %} + +If your app targets users under the age of 13, and the install region **isn't** the USA, you need to mark it as a Kids App. This prevents the SDK from reading device and advertising IDs (for example: `gps_adid` and `android_id`). + +To mark your app as a Kids App, call the `enablePlayStoreKidsCompliance` method on your `AdjustConfig2dx` instance. + +```cpp +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.enablePlayStoreKidsCompliance(); +Adjust2dx::initSdk(adjustConfig); +``` + +## Configure third party sharing options {% #configure-third-party-sharing-options %} + +You can use the Adjust SDK to record when a user changes their third-party sharing settings by instantiating an `AdjustThirdPartySharing2dx` object and passing it to `Adjust2dx::trackThirdPartySharing`. + +### Instantiate a third party sharing object {% #instantiate-a-third-party-sharing-object %} + +To instantiate a third party sharing object, create a new `AdjustThirdPartySharing2dx` instance and pass the following parameters: + +{% deflist %} +`isEnabled` (`bool`) + +: Whether third party sharing is enabled. + +- Pass `true` to enable third party sharing. +- Pass `false` to disable third party sharing. +{% /deflist %} + +```cpp +AdjustThirdPartySharing2dx adjustThirdPartySharing = AdjustThirdPartySharing2dx(true); +``` + +Once you've instantiated your `AdjustThirdPartySharing2dx` object, send the information to Adjust by calling the `Adjust2dx::trackThirdPartySharing` method with your `AdjustThirdPartySharing2dx` instance as an argument. + +```cpp +AdjustThirdPartySharing2dx adjustThirdPartySharing = AdjustThirdPartySharing2dx(true); +Adjust2dx::trackThirdPartySharing(adjustThirdPartySharing); +``` + +### Configure per-partner sharing settings {% #configure-per-partner-sharing-settings %} + +{% callout type="important" %} +For SAN partners, you MAY pass the partner's name as the `partnerName`. For other partners, you MUST pass the partner ID. +{% /callout %} + +If you want to share metrics only with specific partners, or you want to configure which metrics to share with specific partners, you MUST do the following: + +1. Instantiate your `AdjustThirdPartySharing2dx` object with a `true` argument. +1. Customize what data you share on a per-partner basis by calling the `addPartnerSharingSetting` method on your `AdjustThirdPartySharing2dx` instance with the following arguments: + +{% deflist %} +`partnerName` (`std::string`) + +: The ID of the partner. [Download the full list of available partners](https://assets.ctfassets.net/5s247im0esyq/2QQROOadVqJzrME7yXKObe/7aca25e53d38befb2d469809e62b6fcc/3rd-party-sharing-partners.xlsx). + +`key` (`std::string`) + +: The metric you want to update. + +`value` (`bool`) + +: Whether to share the metric with the specified spartner. + +- Pass `false` to stop sharing the metric. +- Pass `true` to resume sharing the metric. +{% /deflist %} + +To share only specific metrics with a partner, you MUST: + +1. Set `all` metrics to `false`. +1. Set each metric you want to share to `true`. + +```cpp +AdjustThirdPartySharing2dx adjustThirdPartySharing = AdjustThirdPartySharing2dx(true); +adjustThirdPartySharing.addPartnerSharingSetting("PartnerA", "all", false); +adjustThirdPartySharing.addPartnerSharingSetting("PartnerA", "install", true); +Adjust2dx::trackThirdPartySharing(adjustThirdPartySharing); +``` + +The following metrics can be controlled using this method: + +{% listcolumns %} +- `ad_revenue` +- `all` +- `attribution` +- `update` +- `att_update` +- `cost_update` +- `event` +- `install` +- `reattribution` + +--- + +- `reattribution_reinstall` +- `reinstall` +- `rejected_install` +- `rejected_reattribution` +- `sdk_click` +- `sdk_info` +- `session` +- `subscription` +- `uninstall` +{% /listcolumns %} + +#### Examples + +If you want to stop sharing all metrics with a specific partner, pass the `all` key with a `false` value. + +```cpp +AdjustThirdPartySharing2dx adjustThirdPartySharing = AdjustThirdPartySharing2dx(true); +adjustThirdPartySharing.addPartnerSharingSetting("PartnerA", "all", false); +Adjust2dx::trackThirdPartySharing(adjustThirdPartySharing); +``` + +To re-enable sharing, pass the `all` key with a `true` value. + +```cpp +AdjustThirdPartySharing2dx adjustThirdPartySharing = AdjustThirdPartySharing2dx(true); +adjustThirdPartySharing.addPartnerSharingSetting("PartnerA", "all", true); +Adjust2dx::trackThirdPartySharing(adjustThirdPartySharing); +``` + +To only share event data with a specific partner: + +- Pass `all` with a `false` value to stop sharing all metrics. +- Pass `event` with a `true` value to start sharing events. + +```cpp +AdjustThirdPartySharing2dx adjustThirdPartySharing = new AdjustThirdPartySharing2dx(true); +adjustThirdPartySharing.addPartnerSharingSetting("PartnerA", "all", false); +adjustThirdPartySharing.addPartnerSharingSetting("PartnerA", "event", true); +Adjust2dx::trackThirdPartySharing(adjustThirdPartySharing); +``` + +### Add per-partner granular information {% #add-per-partner-granular-information %} + +You can attach granular information when a user updates their third party sharing preferences. Use this information to communicate more detail about a user's decision. To do this, call the `addGranularOption` method on your `AdjustThirdPartySharing2dx` instance with the following parameters: + +{% deflist %} +`partnerName` (`std::string`) + +: The ID of the partner. [Download the full list of available partners](https://assets.ctfassets.net/5s247im0esyq/2QQROOadVqJzrME7yXKObe/7aca25e53d38befb2d469809e62b6fcc/3rd-party-sharing-partners.xlsx) + +`key` (`std::string`) + +: The key of the granular information. + +`value` (`std::string`) + +: The value of the granular information. +{% /deflist %} + +```cpp +AdjustThirdPartySharing2dx adjustThirdPartySharing = AdjustThirdPartySharing2dx(true); +adjustThirdPartySharing.addGranularOption("PartnerA", "foo", "bar"); +Adjust2dx::trackThirdPartySharing(adjustThirdPartySharing); +``` + +#### Manage Facebook Limited Data Use {% #manage-facebook-ldu %} + +{% callout type="important" %} +The Adjust SDK sends information to Facebook as soon as the app is installed. You need to make sure you call this method **before** initializing the SDK. +{% /callout %} + +Facebook provides a feature called Limited Data Use (LDU) to comply with the California Consumer Privacy Act (CCPA). This feature enables you to notify Facebook when a California-based user is opted out of the sale of data. You can also use it if you want to opt all users out by default. + +You can update the Facebook LDU status using the following keys: + +{% deflist %} +`data_processing_options_country` + +: The country in which the user is located. + +- `0`: Request that Facebook use geolocation. +- `1`: United States of America. + +`data_processing_options_state` + +: Notifies Facebook in which state the user is located. + +- `0`: Request that Facebook use geolocation. +- `1000`: California. +- `1001`: Colorado. +- `1002`: Connecticut. +{% /deflist %} + +{% callout type="note" %} +If you call this method with a `0` value for **either** `data_processing_options_country` or `data_processing_options_state`, the Adjust SDK passes **both** fields back as `0`. +{% /callout %} + +```cpp +AdjustThirdPartySharing2dx adjustThirdPartySharing = AdjustThirdPartySharing2dx(true); +adjustThirdPartySharing.addGranularOption("facebook", "data_processing_options_country", "1"); +adjustThirdPartySharing.addGranularOption("facebook", "data_processing_options_state", "1000"); +Adjust2dx::trackThirdPartySharing(adjustThirdPartySharing); +``` + +#### Provide consent data to Google (Digital Markets Act compliance) {% #dma-compliance %} + +To comply with the EU's Digital Markets Act (DMA), Google Ads and the Google Marketing Platform require explicit consent to receive Adjust’s attribution requests to their APIs. You MUST communicate the user's consent choices if: + +- You have users in the European Economic Area (EEA). This includes EU member states, Switzerland, Norway, Iceland and Slovenia. +- You use Google Ads or Google Marketing Platform. + +To communicate this consent, add the following granular options to your third party sharing instance for the partner `google_dma`: + +{% deflist %} +`eea` (`1` or `0`) + +: Informs Adjust whether users installing the app are within the European Economic Area (`1`) or not (`0`). + +`ad_personalization` (`1` or `0`) + +: Informs Adjust whether users consented with being served personalized ads via Google Ads and/or Google Marketing Platform (`1`) or not (`0`). + +: This parameter also informs the `npa` parameter reserved for Google Marketing Platform. + +`ad_user_data` (`1` or `0`) + +: Informs Adjust whether users consented with their advertiser ID being leveraged for attribution purposes +{% /deflist %} + +```cpp +AdjustThirdPartySharing2dx adjustThirdPartySharing = AdjustThirdPartySharing2dx(true); +adjustThirdPartySharing.addGranularOption("google_dma", "eea", "1"); +adjustThirdPartySharing.addGranularOption("google_dma", "ad_personalization", "1"); +adjustThirdPartySharing.addGranularOption("google_dma", "ad_user_data", "0"); +Adjust2dx::trackThirdPartySharing(adjustThirdPartySharing); +``` + +If your user isn't in the EEA, you MUST set both `ad_personalization` and `ad_user_data` to `1`. If these values aren't set, Google won't claim attribution and will return an error. + +```cpp +AdjustThirdPartySharing2dx adjustThirdPartySharing = AdjustThirdPartySharing2dx(true); +adjustThirdPartySharing.addGranularOption("google_dma", "eea", "0"); +adjustThirdPartySharing.addGranularOption("google_dma", "ad_personalization", "1"); +adjustThirdPartySharing.addGranularOption("google_dma", "ad_user_data", "1"); +Adjust2dx::trackThirdPartySharing(adjustThirdPartySharing); +``` + +## Set URL strategy {% #set-url-strategy %} + +The URL strategy feature allows you to set either: + +- The country in which Adjust stores your data (data residency). +- The endpoint to which the Adjust SDK sends traffic (URL strategy). + +This is useful if you're operating in a country with strict privacy requirements. When you set your URL strategy, Adjust stores data in the selected data residency region or sends traffic to the chosen domain. + +To set your country of data residency, call the `setUrlStrategy` method on your `AdjustConfig2dx` instance with the following parameter: + +{% deflist %} +`urlStrategyDomains` (`std::vector`) + +: The endpoints to which you want to send SDK traffic. + +`shouldUseSubdomains` (`bool`) + +: Whether the source should prefix a subdomain. + +`isDataResidency` (`bool`) + +: Whether the domain should be used for data residency. +{% /deflist %} + +See the table below for a list of strategies. + +| URL strategy | Main and fallback domain | Use sub domains | Is Data Residency | +| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | +| EU data residency | `"eu.adjust.com"` | `true` | `true` | +| Turkish data residency | `"tr.adjust.com"` | `true` | `true` | +| US data residency | `"us.adjust.com"` | `true` | `true` | +| China global URL strategy | `"adjust.world"`, `"adjust.com"` | `true` | `false` | +| China URL strategy | `"adjust.cn"`, `"adjust.com"` | `true` | `false` | +| China only URL strategy | `"adjust.cn"` | `true` | `false` | +| India URL strategy | `"adjust.net.in"`, `"adjust.com"` | `true` | `false` | + +```cpp +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setUrlStrategy({"eu.adjust.com"}, true, true); +Adjust2dx::initSdk(adjustConfig); +``` + +## Toggle consent measurement per user {% #toggle-consent-measurement-per-user %} + +If you've enabled [Data Privacy settings](https://help.adjust.com/en/article/manage-data-collection-and-retention) in Adjust, you need to set up the Adjust SDK to work with them. This includes settings such as consent expiry period and user data retention period. + +To toggle this feature, call the `trackMeasurementConsent` method with the following argument: + +{% deflist %} +`measurementConsent` (`bool`) + +: Whether consent measurement is enabled (`true`) or not (`false`). +{% /deflist %} + +When enabled, the SDK communicates the data privacy settings to Adjust's servers. Adjust's servers then applies your data privacy rules to the user. The Adjust SDK continues to work as expected. + +```cpp +Adjust2dx::trackMeasurementConsent(true); +``` diff --git a/src/content/docs/sdk/cocos2dx/v5/features/purchase-verification.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/purchase-verification.mdoc new file mode 100644 index 000000000..45102a564 --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/purchase-verification.mdoc @@ -0,0 +1,205 @@ +--- +title: Purchase verification +description: Verify your App Store and Play Store purchases +slug: en/sdk/cocos2dx/features/purchase-verification +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/unity/v4/features/events +--- + +If you've enabled [purchase verification](https://help.adjust.com/en/article/purchase-verification), you can use the Adjust SDK to request purchase verification. There are two ways to verify purchases with the Adjust SDK: + +1. Create an `AdjustEvent2dx` object that represents your purchase and configure purchase properties for the target store. +1. Create an `AdjustAppStorePurchase2dx` (Apple App Store) or `AdjustPlayStorePurchase2dx` (Google Play Store) object representing the purchase. + +{% callout type="tip" %} +If you use revenue events to measure your purchases in Adjust, you should use the `AdjustEvent2dx` class. If you only want to verify a purchase but don't want to associate it with an event, use the `AdjustAppStorePurchase2dx` or `AdjustPlayStorePurchase2dx` class. +{% /callout %} + +When you send purchase information with the Adjust SDK, Adjust does the following: + +1. Sends the information to the relevant store and waits for a status response. +1. Forwards the status response to the Adjust SDK. + +You can access the purchase verification status by using a callback. Results are returned as `AdjustPurchaseVerificationResult2dx` objects containing the following properties: + +{% deflist %} +`verificationStatus` (`std::string`) + +: The status of the purchase. + +`code` (`int`) + +: The status code of the purchase. + +`message` (`std::string`) + +: Any message returned by the store. +{% /deflist %} + +## Verify purchase and record event {% #verify-purchase-and-record-event %} + +To send a revenue event for verification and listen for the purchase verification status, follow these steps. + +### App Store purchases {% #app-store-purchases %} + +1. Instantiate an `AdjustEvent2dx` object with the your event token and set the following parameters: + + {% deflist %} + `productId` (`std::string`) + + : The product identifier of the item that was successfully purchased. + + `transactionId` (`std::string`) + + : The ID of the transaction you want to verify. + {% /deflist %} + +1. Call the `Adjust2dx::verifyAndTrackPlayStorePurchase` method with the following arguments: + + {% deflist %} + `event` (`AdjustEvent2dx`) + + : Your instantiated event object. + + `callback` (`void(*callback)`) + + : A delegate callback function that receives an `AdjustPurchaseVerificationResult2dx` object as an argument. + {% /deflist %} + +In this example, the purchase verification response is output to the logging daemon. + +```cpp +AdjustEvent2dx adjustEvent = AdjustEvent2dx("{% $variables.event.token %}"); +adjustEvent.setRevenue({% $variables.event.revenue.amount %}, "{% $variables.event.revenue.currency %}"); +adjustEvent.setTransactionId("{% $variables.event.transactionId %}"); +adjustEvent.setProductId("{% $variables.event.revenue.productId %}"); +Adjust2dx::verifyAndTrackPlayStorePurchase(adjustEvent, [](AdjustPurchaseVerificationResult2dx verificationResult) { + log("Verification status: %s", verificationResult.verificationStatus); + log("Code: %s", verificationResult.code); + log("Message: %s", verificationResult.message); +}); +``` + +### Play Store purchases {% #play-store-purchases %} + +1. Instantiate an `AdjustEvent2dx` object with the your event token and set the following parameters: + + {% deflist %} + `productId` (`std::string`) + + : The ID of the product that has been purchased. + + `purchaseToken` (`std::string`) + + : The purchase token associated with the purchase. + {% /deflist %} + +1. Call the `Adjust::verifyAndTrackPlayStorePurchase` method with the following arguments: + + {% deflist %} + `event` (`AdjustEvent2dx`) + + : Your instantiated event object. + + `callback` (`void(*callback)`) + + : A delegate callback function that receives an `AdjustPurchaseVerificationResult2dx` object as an argument. + {% /deflist %} + +In this example, the purchase verification response is output to the logging daemon. + +```cpp +AdjustEvent2dx adjustEvent = AdjustEvent("{% $variables.event.token %}"); +adjustEvent.setRevenue({% $variables.event.revenue.amount %}, "{% $variables.event.revenue.currency %}"); +adjustEvent.setProductId("{% $variables.event.productId %}"); +adjustEvent.setPurchaseToken("{% $variables.event.revenue.purchaseToken %}"); +Adjust2dx::verifyAndTrackPlayStorePurchase(adjustEvent, [](AdjustPurchaseVerificationResult2dx verificationResult) { + log("Verification status: %s", verificationResult.verificationStatus); + log("Code: %s", verificationResult.code); + log("Message: %s", verificationResult.message); +}); +``` + +## Only verify purchase {% #only-verify-purchase %} + +To send standalone purchase information and listen for the purchase verification status, follow these steps: + +### App Store purchases {% #app-store-only-verify %} + +1. Instantiate an `AdjustAppStorePurchase2dx` object with the following arguments: + + {% deflist %} + `productId` (`std::string`) + + : The product identifier of the item that was successfully purchased. + + `transactionId` (`std::string`) + + : The ID of the transaction you want to verify. + {% /deflist %} + +1. Call the `Adjust2dx::verifyAppStorePurchase` method with the following arguments: + + {% deflist %} + `purchase` (`AdjustAppStorePurchase2dx`) + + : Your instantiated purchase object. + + `callback` (`void(*callback)`) + + : A delegate callback function that receives an `AdjustPurchaseVerificationResult2dx` object as an argument. + {% /deflist %} + +In this example, the purchase verification response is output to the logging daemon. + +```cpp +AdjustAppStorePurchase2dx purchase = AdjustAppStorePurchase2dx("{% $variables.event.productId %}", "{% $variables.event.transactionId %}"); +Adjust2dx::verifyAppStorePurchase(purchase, [](AdjustPurchaseVerificationResult2dx verificationResult) { + log("Verification status: %s", verificationResult.verificationStatus); + log("Code: %s", verificationResult.code); + log("Message: %s", verificationResult.message); +}); +``` + +### Play Store purchases {% #play-store-only-verify %} + +1. Instantiate an `AdjustPlayStorePurchase2dx` with the following arguments: + + {% deflist %} + `productId` (`std::string`) + + : The ID of the product that has been purchased. + + `purchaseToken` (`std::string`) + + : The purchase token associated with the purchase. + {% /deflist %} + +1. Call the `Adjust2dx::verifyPlayStorePurchase` method with the following arguments: + + {% deflist %} + `purchase` (`AdjustPlayStorePurchase2dx`) + + : Your instantiated purchase object. + + `callback` (`void(*callback)`) + + : A delegate callback function that receives an `AdjustPurchaseVerificationResult2dx` object as an argument. + {% /deflist %} + +In this example, the purchase verification response is output to the logging daemon. + +```cpp +AdjustPlayStorePurchase2dx purchase = AdjustPlayStorePurchase2dx("{% $variables.event.productId %}", "{% $variables.event.purchaseToken %}"); +Adjust2dx::verifyPlayStorePurchase(purchase, [](AdjustPurchaseVerificationResult2dx verificationResult) { + log("Verification status: %s", verificationResult.verificationStatus); + log("Code: %s", verificationResult.code); + log("Message: %s", verificationResult.message); +}); +``` diff --git a/src/content/docs/sdk/cocos2dx/v5/features/short-links.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/short-links.mdoc new file mode 100644 index 000000000..382dd9088 --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/short-links.mdoc @@ -0,0 +1,51 @@ +--- +title: Resolve short branded links +description: Resolve short links that were created in Campaign Lab. +slug: en/sdk/cocos2dx/features/short-links +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/features/short-links +--- + +Adjust's [link shortener solution](https://help.adjust.com/en/article/short-branded-links) converts your complex and long links into cleaner and shorter links. The shortened links retain deep link and campaign information, and route users to the app store, if they don't have your app installed. + +Use the method described in this section to resolve your short links. + +## Set up deep linking in the Adjust SDK {% #set-up-deep-linking-in-the-adjust-sdk %} + +{% callout type="note" %} +You don't need to set up LinkMe or Link resolution to use Adjust’s link shortener solution. +{% /callout %} + +In the Adjust SDK, add support for the following: + +- [URI schemes](/en/sdk/cocos2dx/features/deep-links) +- [Deferred deep linking](/en/sdk/cocos2dx/features/deep-links#deferred-deep-linking) + +## Set up the Adjust SDK to resolve short links {% #set-up-the-adjust-sdk-to-resolve-short-links %} + +To resolve a short Adjust link URL that deep linked users into your app, call the `Adjust2dx::processAndResolveDeeplink` method with the following arguments: + +{% deflist %} +`deeplink` (`AdjustDeeplink2dx`) + +: The deep link you want to resolve. + +`resolvedLinkCallback` (`void(std::string)`) + +: A function that receives the resolved deep link. Must return `void`. +{% /deflist %} + +```cpp +AdjustDeeplink2dx deeplink = AdjustDeeplink2dx("url"); +Adjust2dx::processAndResolveDeeplink(deeplink, [](std::string resolvedLink) { + // process resolvedLink +}); +``` + +If you pass a shortened link to the `Adjust2dx::processAndResolveDeeplink` method, you receive the original expanded link in your `deeplinkResolvedCallback` function. If you pass a non-shortened link, the `deeplinkResolvedCallback` function receives the link you passed to `Adjust2dx::processAndResolveDeeplink` without modification. diff --git a/src/content/docs/sdk/cocos2dx/v5/features/skan.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/skan.mdoc new file mode 100644 index 000000000..b52ade23e --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/skan.mdoc @@ -0,0 +1,77 @@ +--- +title: Set up SKAN and conversion values +description: Configure SKAN features for your iOS apps. +slug: en/sdk/cocos2dx/features/skan +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v5: /en/sdk/cocos2dx/v4/features/skad +--- + +StoreKit Ad Network (SKAN) is Apple's framework for app install and reinstall attribution. The SKAN workflow goes like this: + +1. Apple gathers attribution information and notifies the relevant ad network. +1. The network sends a postback with this information to Adjust. +1. Adjust displays SKAN data in [Datascape](https://help.adjust.com/en/suite/article/datascape) and [Data Canvas](https://help.adjust.com/en/classic/article/data-canvas-classic). + +## Disable SKAN communication {% #disable-skadnetwork-communication %} + +The Adjust SDK registers for SKAN attribution upon initialization by default. To disable this behavior, call the `disableSkanAttribution` method on your `AdjustConfig2dx` instance. + +```cpp +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.disableSkanAttribution(); +Adjust2dx::initSdk(adjustConfig); +``` + +## Update conversion values {% #update-conversion-values %} + +Conversion values are a mechanism used to track user behavior in SKAN. You can map 64 conditions to values from 0 through 63 and send this integer value to SKAN on user install. This gives you insight into how your users interact with your app in the first few days. + +If you manage your conversion values with Adjust, the servers update this value in the SDK. You can also update this value by using the `updateSkanConversionValue` method. This method wraps [Apple's `updatePostbackConversionValue` method](https://developer.apple.com/documentation/storekit/skadnetwork/4097267-updatepostbackconversionvalue). You MUST pass the following arguments: + +{% deflist %} +`fineValue` (`int`) + +: Your conversion value. Must be between `0` and `63`. + +`coarseValue` (`std::string`) + +: The coarse conversion value. This value is used if your app doesn't have sufficient installs to reach the privacy threshold. The following values are allowed: + +- `"low"` (`SKAdNetworkCoarseConversionValueLow`) +- `"medium"` (`SKAdNetworkCoarseConversionValueMedium`) +- `"high"` (`SKAdNetworkCoarseConversionValueHigh`) + +`lockWindow` (`bool`) + +: Whether to send the postback before the conversion window ends (`true`). + +`errorCallback` (`function`) + +: A function that receives any error message returned by SKAN as a `string`. +{% /deflist %} + +```cpp +Adjust2dx::updateSkanConversionValue(6, "low", true, [](std::string error) { + std::cout << "Error while updating conversion value: " << error; +}); +``` + +## Listen for changes to conversion values {% #listen-for-changes-to-conversion-values %} + +If you use Adjust to manage conversion values, the Adjust's servers send conversion value updates to the SDK. You can set up a callback function to listen for these changes using the `setSkanUpdatedCallback` method. Pass your function as an argument. + +```cpp +adjustConfig.setSkanUpdatedCallback([]( + std::unordered_map data) { + std::cout << "\nConversion value: " << data["conversionValue"]; + std::cout << "\nCoarse value: " << data["coarseValue"]; + std::cout << "\nLock window: " << data["lockWindow"]; + std::cout << "\nError: " << data["error"]; +}); +``` diff --git a/src/content/docs/sdk/cocos2dx/v5/features/subscriptions.mdoc b/src/content/docs/sdk/cocos2dx/v5/features/subscriptions.mdoc new file mode 100644 index 000000000..46dd4575b --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/features/subscriptions.mdoc @@ -0,0 +1,322 @@ +--- +title: Send subscription information +description: Use these methods send subscription information to Adjust. +slug: en/sdk/cocos2dx/features/subscriptions +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4/features/subscriptions +--- + +{% callout type="important" %} +The following steps only set up subscription tracking within the Adjust SDK. To enable the feature, Adjust need to set up app-specific information. Contact support@adjust.com or talk to your Technical Account manager to set this up. +{% /callout %} + +You can record App Store and Play Store subscriptions and verify their validity with the Adjust SDK. + +## How it works {% #how-it-works %} + +After the user purchases a subscription, create an `AdjustAppStoreSubscription2dx` or `AdjustPlayStoreSubscription2dx` instance. These classes contain properties representing subscription details that allow Adjust to measure the subscription event. + +## App Store subscriptions {% #app-store-subscriptions %} + +The `AdjustAppStoreSubscription2dx` class represents App Store subscription information. You can create multiple instances of this class to send subscription information to Adjust. + +To get started, you need to instantiate a subscription object containing details of the subscription purchase. + +### Instantiate an App Store subscription object {% #instantiate-an-app-store-subscription-object %} + +Instantiate an `AdjustAppStoreSubscription2dx` object with the following arguments: + +{% deflist %} +`price` (`std::string`) + +: The price of the subscription + +`currency` (`std::string`) + +: The currency of the subscription. Formatted as the [`currencyCode`](https://developer.apple.com/documentation/foundation/nslocale/1642836-currencycode?language=objc) of the [`priceLocale`](https://developer.apple.com/documentation/storekit/skproduct/1506145-pricelocale?language=objc) object. + +`transactionId` (`std::string`) + +: Your ID for the transaction. +{% /deflist %} + +```cpp +AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx( + {% $variables.subscription.appStoreSubscription.price %}, // price + {% $variables.subscription.appStoreSubscription.currency %}, // currency + {% $variables.subscription.appStoreSubscription.transactionId %} // transactionId +); +``` + +### Record the purchase date {% #record-the-purchase-date-app-store %} + +You can record the date on which the user purchased a subscription. The SDK returns this data for you to report on. + +Call the `setTransactionDate` method on your subscription object to record the timestamp of the subscription. + +{% deflist %} +`transactionDate` (`std::string`) + +: The timestamp of the subscription +{% /deflist %} + +```cpp +AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx( + {% $variables.subscription.appStoreSubscription.price %}, // price + {% $variables.subscription.appStoreSubscription.currency %}, // currency + {% $variables.subscription.appStoreSubscription.transactionId %} // transactionId +); +subscription.setTransactionDate({% $variables.subscription.appStoreSubscription.transactionDate %}); +``` + +### Record the purchase region {% #record-the-purchase-region %} + +You can record the region in which the user purchased a subscription. To do this, call the `setSalesRegion` method on your subscription object and pass the country code as a **string**. This needs to be formatted as the [`countryCode`](https://developer.apple.com/documentation/storekit/storefront/3792000-countrycode) of the [`Storefront`](https://developer.apple.com/documentation/storekit/storefront) object. + +{% deflist %} +`salesRegion` (`std::string`) + +: The country code for the subscription. +{% /deflist %} + +```cpp +AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx( + {% $variables.subscription.appStoreSubscription.price %}, // price + {% $variables.subscription.appStoreSubscription.currency %}, // currency + {% $variables.subscription.appStoreSubscription.transactionId %} // transactionId +); +subscription.setSalesRegion({% $variables.subscription.appStoreSubscription.salesRegion %}); +``` + +### Add callback parameters {% #add-callback-parameters-app-store %} + +You can add callback parameters to your subscription object. The SDK appends these parameters to your callback URL. To add callback parameters, call the `addCallbackParameter` method on your subscription object. You can add multiple callback parameters by calling this method multiple times. + +```cpp +AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx( + {% $variables.subscription.appStoreSubscription.price %}, // price + {% $variables.subscription.appStoreSubscription.currency %}, // currency + {% $variables.subscription.appStoreSubscription.transactionId %} // transactionId +); +subscription.addCallbackParameter({% $variables.subscription.key1 %}); +subscription.addCallbackParameter({% $variables.subscription.key2 %}); +``` + +### Add partner parameters {% #add-partner-parameters-app-store %} + +You can add partner parameters to your subscription object. The SDK sends these to Adjust's servers when the user purchases a subscription. Adjust's servers forward the information on to your network partner. To add partner parameters, call the `addPartnerParameter` method on your subscription object. You can add multiple partner parameters by calling this method multiple times. + +```cpp +AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx( + {% $variables.subscription.appStoreSubscription.price %}, // price + {% $variables.subscription.appStoreSubscription.currency %}, // currency + {% $variables.subscription.appStoreSubscription.transactionId %} // transactionId +); +subscription.addPartnerParameter({% $variables.subscription.key1 %}); +subscription.addPartnerParameter({% $variables.subscription.key2 %}); +``` + +### App Store subscription tutorial {% #tutorial-app-store %} + +Once you have set up your subscription object, you can record it using the Adjust SDK. + +This tutorial demonstrates how to use the `AdjustAppStoreSubscription2dx` and `AdjustPlayStoreSubscription2dx` classes to send subscription information to Adjust. You will learn: + +1. How to create create and populate an `AdjustAppStoreSubscription2dx` or `AdjustPlayStoreSubscription2dx` instance. +1. How to use the `AdjustAppStoreSubscription2dx` and `AdjustPlayStoreSubscription2dx` classes in your app to send subscription information to Adjust. + +To send subscription information to Adjust, follow these steps: + +1. Instantiate and populate an `AdjustAppStoreSubscription2dx` object with the `price`, `currency`, and `transactionId`. In the example below, the following values are used: + - The `price` is _{% $variables.subscription.appStoreSubscription.price %}_. + - The `currency` is _{% $variables.subscription.appStoreSubscription.currency %}_. + - The `transactionId` is _{% $variables.subscription.appStoreSubscription.transactionId %}_ +1. In the example below, the following properties are set: + - The transaction date is set to _{% $variables.subscription.appStoreSubscription.transactionDate %}_ + - The sales region is set to _{% $variables.subscription.appStoreSubscription.salesRegion %}_. + - The callback parameters are set to _{% $variables.subscription.key1 %}_ and _{% $variables.subscription.key2 %}_. + - The partner parameters are set to _{% $variables.subscription.key1 %}_ and _{% $variables.subscription.key2 %}_. +1. At the end of your function, send the information to Adjust by calling `trackAppStoreSubscription` with your `AdjustAppStoreSubscription2dx` instance as an argument. + +```cpp +#include "Adjust/Adjust2dx.h" + +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +Adjust2dx::initSdk(adjustConfig); + +AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx( + {% $variables.subscription.appStoreSubscription.price %}, // price + {% $variables.subscription.appStoreSubscription.currency %}, // currency + {% $variables.subscription.appStoreSubscription.transactionId %} // transactionId +); +subscription.setTransactionDate({% $variables.subscription.appStoreSubscription.transactionDate%}); +subscription.setSalesRegion({% $variables.subscription.appStoreSubscription.salesRegion %}); +subscription.addCallbackParameter({% $variables.subscription.key1 %}); +subscription.addCallbackParameter({% $variables.subscription.key2 %}); +subscription.addPartnerParameter({% $variables.subscription.key1 %}); +subscription.addPartnerParameter({% $variables.subscription.key2 %}); +Adjust2dx::trackAppStoreSubscription(subscription); +``` + +## Play Store subscriptions {% #play-store-subscriptions %} + +The `AdjustPlayStoreSubscription2dx` class represents App Store subscription information. You can create multiple instances of this class to send subscription information to Adjust. + +To get started, you need to instantiate a subscription object containing details of the subscription purchase. + +### Instantiate a Play Store subscription object {% #instantiate-a-play-store-subscription-object %} + +Instantiate an `AdjustPlayStoreSubscription2dx` object with the following arguments: + +{% deflist %} +`price` (`std::string`) + +: The price of the subscription + +`currency` (`std::string`) + +: The currency of the subscription + +`sku` (`std::string`) + +: The ID of the product + +`orderId` (`std::string`) + +: Your ID for the transaction + +`signature` (`std::string`) + +: The signature of the purchase data + +`purchaseToken` (`std::string`) + +: The unique token of the transaction. See [Google's documentation](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getPurchaseToken\(\)) for more information +{% /deflist %} + +```cpp +AdjustPlayStoreSubscription2dx subscription = AdjustPlayStoreSubscription2dx( + {% $variables.subscription.playStoreSubscription.price %}, // price + {% $variables.subscription.playStoreSubscription.currency %}, // currency + {% $variables.subscription.playStoreSubscription.sku %}, // sku + {% $variables.subscription.playStoreSubscription.orderId %}, // orderId + {% $variables.subscription.playStoreSubscription.signature %}, // signature + {% $variables.subscription.playStoreSubscription.purchaseToken %} // purchaseToken +); +``` + +### Record the purchase date {% #record-the-purchase-date-play-store %} + +You can record the date on which the user purchased a subscription. The SDK returns this data for you to report on. + +Call the `setPurchaseTime` method on your subscription object to record the timestamp of the subscription. + +{% deflist %} +`purchaseTime` (`std::string`) + +: The timestamp of the subscription. +{% /deflist %} + +```cpp +AdjustPlayStoreSubscription2dx subscription = AdjustPlayStoreSubscription2dx( + {% $variables.subscription.playStoreSubscription.price %}, // price + {% $variables.subscription.playStoreSubscription.currency %}, // currency + {% $variables.subscription.playStoreSubscription.sku %}, // sku + {% $variables.subscription.playStoreSubscription.orderId %}, // orderId + {% $variables.subscription.playStoreSubscription.signature %}, // signature + {% $variables.subscription.playStoreSubscription.purchaseToken %} // purchaseToken +); +subscription.setPurchaseTime({% $variables.subscription.playStoreSubscription.purchaseTime%}); +``` + +### Add callback parameters {% #add-callback-parameters-play-store %} + +You can add callback parameters to your subscription object. The SDK appends these parameters to your callback URL. To add callback parameters, call the `addCallbackParameter` method on your subscription object. You can add multiple callback parameters by calling this method multiple times. + +```cpp +AdjustPlayStoreSubscription2dx subscription = AdjustPlayStoreSubscription2dx( + {% $variables.subscription.playStoreSubscription.price %}, // price + {% $variables.subscription.playStoreSubscription.currency %}, // currency + {% $variables.subscription.playStoreSubscription.sku %}, // sku + {% $variables.subscription.playStoreSubscription.orderId %}, // orderId + {% $variables.subscription.playStoreSubscription.signature %}, // signature + {% $variables.subscription.playStoreSubscription.purchaseToken %} // purchaseToken +); +subscription.addCallbackParameter({% $variables.subscription.key1 %}); +subscription.addCallbackParameter({% $variables.subscription.key2 %}); +``` + +### Add partner parameters {% #add-partner-parameters-play-store %} + +You can add partner parameters to your subscription object. The SDK sends these to Adjust's servers when the user purchases a subscription. Adjust's servers forward the information on to your network partner. To add partner parameters, call the `addPartnerParameter` method on your subscription object. You can add multiple partner parameters by calling this method multiple times. + +```cpp +AdjustPlayStoreSubscription2dx subscription = AdjustPlayStoreSubscription2dx( + {% $variables.subscription.playStoreSubscription.price %}, // price + {% $variables.subscription.playStoreSubscription.currency %}, // currency + {% $variables.subscription.playStoreSubscription.sku %}, // sku + {% $variables.subscription.playStoreSubscription.orderId %}, // orderId + {% $variables.subscription.playStoreSubscription.signature %}, // signature + {% $variables.subscription.playStoreSubscription.purchaseToken %} // purchaseToken +); +subscription.addPartnerParameter({% $variables.subscription.key1 %}); +subscription.addPartnerParameter({% $variables.subscription.key2 %}); +``` + +### Play Store subscription tutorial {% #tutorial-play-store %} + +Once you have set up your subscription object, you can record it using the Adjust SDK. + +This tutorial demonstrates how to use the `AdjustAppStoreSubscription2dx` and `AdjustPlayStoreSubscription2dx` classes to send subscription information to Adjust. You will learn: + +1. How to create create and populate an `AdjustAppStoreSubscription2dx` or `AdjustPlayStoreSubscription2dx` instance. +1. How to use the `AdjustAppStoreSubscription2dx` and `AdjustPlayStoreSubscription2dx` classes in your app to send subscription information to Adjust. + +To send subscription information to Adjust, follow these steps: + +1. Instantiate and populate an `AdjustPlayStoreSubscription2dx` object with the `price`, `currency`, `sku`, `orderId`, `signature`, `purchaseToken`. In the example below, the following values are used: + - The `price` is _{% $variables.subscription.playStoreSubscription.price %}_. + - The `currency` is _{% $variables.subscription.playStoreSubscription.currency %}_. + - The `sku` is _{% $variables.subscription.playStoreSubscription.sku %}_. + - The `orderId` is _{% $variables.subscription.playStoreSubscription.orderId %}_. + - The `signature` is _{% $variables.subscription.playStoreSubscription.signature %}_. + - The `purchaseToken` is _{% $variables.subscription.playStoreSubscription.purchaseToken %}_. +1. In the example below, the following properties are set: + - The purchase time is set to _{% $variables.subscription.playStoreSubscription.purchaseTime %}_ + - The callback parameters are set to _{% $variables.subscription.key1 %}_ and _{% $variables.subscription.key2 %}_. + - The partner parameters are set to _{% $variables.subscription.key1 %}_ and _{% $variables.subscription.key2 %}_. +1. At the end of your function, send the information to Adjust by calling `trackPlayStoreSubscription` with your `AdjustAppStoreSubscription2dx` instance as an argument. + +```cpp +#include "Adjust/Adjust2dx.h" + +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +Adjust2dx::initSdk(adjustConfig); + +AdjustPlayStoreSubscription2dx subscription = AdjustPlayStoreSubscription2dx( + {% $variables.subscription.playStoreSubscription.price %}, // price + {% $variables.subscription.playStoreSubscription.currency %}, // currency + {% $variables.subscription.playStoreSubscription.sku %}, // sku + {% $variables.subscription.playStoreSubscription.orderId %}, // orderId + {% $variables.subscription.playStoreSubscription.signature %}, // signature + {% $variables.subscription.playStoreSubscription.purchaseToken %} // purchaseToken +); +subscription.setPurchaseTime({% $variables.subscription.playStoreSubscription.purchaseTime%}); +subscription.addCallbackParameter({% $variables.subscription.key1 %}); +subscription.addCallbackParameter({% $variables.subscription.key2 %}); +subscription.addPartnerParameter({% $variables.subscription.key1 %}); +subscription.addPartnerParameter({% $variables.subscription.key2 %}); +Adjust2dx::trackPlayStoreSubscription(subscription); +``` diff --git a/src/content/docs/sdk/cocos2dx/v5/index.mdoc b/src/content/docs/sdk/cocos2dx/v5/index.mdoc new file mode 100644 index 000000000..964ed0ad0 --- /dev/null +++ b/src/content/docs/sdk/cocos2dx/v5/index.mdoc @@ -0,0 +1,264 @@ +--- +title: Cocos2d-x SDK integration guide +description: Use the Web SDK to access Adjust's features in your Cocos2d-x apps +category-title: Cocos2d-x SDK +slug: en/sdk/cocos2dx +sidebar-position: 7 +versions: + - label: v5 + value: v5 + default: true + - label: v4 + value: v4 +redirects: + v4: /en/sdk/cocos2dx/v4 +--- + +The Adjust Android SDK enables you to record attribution, events, and more in your Cocos2d-x app. Follow the steps in this guide to set up your app to work with the Adjust SDK. + +## 1. Install the SDK {% #install-the-sdk %} + +To start using SDK v5, you need to add it as a dependency in your project. To do this: + +1. Download the SDK archive [from GitHub](https://github.com/adjust/cocos2dx_sdk/releases) + +1. Copy the C++ files from the `dist` directory and add them to your Cocos2d-x project + +1. (**Android only**): add the paths of the C++ files to the `LOCAL_SRC_FILES` section of your `Android.mk` file. + + ```text + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustConfig2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustAttribution2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustProxy2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustEvent2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/Adjust2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustEventFailure2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustEventSuccess2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustSessionFailure2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustSessionSuccess2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustAppStoreSubscription2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustPlayStoreSubscription2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustThirdPartySharing2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustAdRevenue2dx.cpp + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustAppStorePurchase2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustPlayStorePurchase2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustDeeplink2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustPurchaseVerificationResult2dx.cpp \ + ``` + + If you're using CMake, add the following list of sources and headers to your `CMakeLists.txt` file: + + ```cmake + # add cross-platforms source files and header files + list(APPEND GAME_SOURCE + Classes/Adjust/AdjustConfig2dx.cpp + Classes/Adjust/AdjustAttribution2dx.cpp + Classes/Adjust/AdjustProxy2dx.cpp + Classes/Adjust/AdjustEvent2dx.cpp + Classes/Adjust/AdjustAdRevenue2dx.cpp + Classes/Adjust/AdjustAppStoreSubscription2dx.cpp + Classes/Adjust/AdjustPlayStoreSubscription2dx.cpp + Classes/Adjust/AdjustAppStorePurchase2dx.cpp + Classes/Adjust/AdjustPlayStorePurchase2dx.cpp + Classes/Adjust/Adjust2dx.cpp + Classes/Adjust/AdjustEventFailure2dx.cpp + Classes/Adjust/AdjustEventSuccess2dx.cpp + Classes/Adjust/AdjustSessionFailure2dx.cpp + Classes/Adjust/AdjustSessionSuccess2dx.cpp + Classes/Adjust/AdjustThirdPartySharing2dx.cpp + Classes/Adjust/AdjustDeeplink2dx.cpp + Classes/Adjust/AdjustPurchaseVerificationResult2dx.cpp + ) + list(APPEND GAME_HEADER + Classes/Adjust/AdjustConfig2dx.h + Classes/Adjust/AdjustAttribution2dx.h + Classes/Adjust/AdjustProxy2dx.h + Classes/Adjust/AdjustEvent2dx.h + Classes/Adjust/AdjustAdRevenue2dx.h + Classes/Adjust/AdjustAppStoreSubscription2dx.h + Classes/Adjust/AdjustPlayStoreSubscription2dx.h + Classes/Adjust/AdjustAppStorePurchase2dx.h + Classes/Adjust/AdjustPlayStorePurchase2dx.h + Classes/Adjust/Adjust2dx.h + Classes/Adjust/AdjustEventFailure2dx.h + Classes/Adjust/AdjustEventSuccess2dx.h + Classes/Adjust/AdjustSessionFailure2dx.h + Classes/Adjust/AdjustSessionSuccess2dx.h + Classes/Adjust/AdjustThirdPartySharing2dx.h + Classes/Adjust/AdjustDeeplink2dx.h + Classes/Adjust/AdjustPurchaseVerificationResult2dx.h + ) + ``` + +1. (**Android only**): download the latest `adjust-android.aar` from [the GitHub releases page](https://github.com/adjust/cocos2dx_sdk/releases/latest) and import it into your Android Studio project. + +1. (**iOS only**): download the latest `AdjustSdk.framework` from [the GitHub releases page](https://github.com/adjust/cocos2dx_sdk/releases/latest) and link it in your Xcode project. + +## 2. Set up the Signature library {% #signature-setup %} + +SDK v5 uses the [SDK signature library](https://help.adjust.com/en/article/sdk-signature) to encrypt information sent from the Adjust SDK to Adjust's servers. You MUST add the signature library to your project to use SDK v5. + +### Android apps + +1. Download the latest `adjust-android-signature.aar` from [the Adjust Signature library GitHub repository](https://github.com/adjust/adjust_signature_sdk/releases/latest). +1. Add the `.aar` to your Android Studio project. + +### iOS apps + +1. Download the latest `AdjustSigSdk-iOS-Static.a` from [the Adjust Signature library GitHub repository](https://github.com/adjust/adjust_signature_sdk/releases/latest). +1. Link the `.a` in your Xcode project. + +## 3. Configure Android settings {% #android-settings %} + +Follow these steps to configure the Adjust SDK for Android devices. + +### Permissions {% #android-permissions %} + +The Adjust Android SDK comes with required permissions preconfigured. This includes the `com.google.android.gms.permission.AD_ID` permission. If your app needs to be compliant with the Children's Online Privacy Protection Act (COPPA), you MUST remove this permission by adding the following to your `AndroidManifest.xml` file: + +```xml + +``` + +To learn more about COPPA, read [Adjust's COPPA compliance article](https://help.adjust.com/en/article/coppa-compliance). + +### Add Google Play Services {% #add-google-play-services %} + +Apps that target the Google Play Store must use the [Google Advertising ID](https://support.google.com/googleplay/android-developer/answer/6048248?hl=en) (`gps_adid`) to identify devices. To do this, add the following dependency to the `dependencies` section of your `build.gradle` file. + +```groovy +dependencies: { + implementation 'com.google.android.gms:play-services-ads-identifier:18.1.0' +} +``` + +### Set up install referrer {% #set-up-install-referrer %} + +The install referrer is an attribution mechanism you can use to attribute an app install to a source. It consists of two parts: + +- A set of APIs from these app stores that allow developers to retrieve referral content in their apps. +- A `referrer` parameter that app stores, such as Google Play and Huawei App Gallery, accept in their app page URLs on their store websites. Here is how the referrer parameter is populated: + - When a user clicks on an Adjust link, the Adjust server passes a unique identifier called `reftag`. This identifier is assigned to the click and into the referrer parameter. To learn more about reftag, see the [Reftag article in the Help Center](https://help.adjust.com/en/article/reftag). + - When you run [Google Ads](https://support.google.com/google-ads/answer/6357635?hl=en) campaigns, Google passes a unique identifier called `gclid` into the referrer parameter. You MUST enable **Auto-tagging** in your Google Ads account. + +#### Google Play Referrer API + +To support the [Google Play Referrer API](https://developer.android.com/google/play/installreferrer), follow these steps: + +1. Add the Google Maven repository to your `build.gradle` file. + + ```groovy + allprojects { + repositories { + maven { + url "https://maven.google.com" + } + } + } + ``` + +1. Add the Install Referrer library to your `build.gradle` file. + + ```groovy + dependencies { + implementation 'com.android.installreferrer:installreferrer:2.2' + } + ``` + +#### Meta Install Referrer + +To add support for the [Meta Install Referrer](https://developers.facebook.com/docs/app-ads/meta-install-referrer), follow these steps: + +1. Install the Adjust Android Meta Referrer plugin by adding the following dependency to your `build.gradle` file: + + ```groovy + dependencies { + implementation 'com.adjust.sdk:adjust-android-meta-referrer:{% $versions.android.v5 %}' + } + ``` + +1. Find your Meta app ID in your [Meta app dashboard](https://developers.facebook.com/apps). + +1. Call the `setFbAppId` method on your `AdjustConfig2dx` instance with your Meta App ID as an argument. + + ```cpp + #include "Adjust/Adjust2dx.h" + + std::string appToken = "{% $variables.config.token %}"; + std::string environment = AdjustEnvironmentSandbox2dx; + + AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); + adjustConfig.setFbAppId("{% $variables.config.fbAppId %}"); + Adjust2dx::initSdk(adjustConfig); + ``` + +## 4. Configure iOS settings {% #ios-settings %} + +Follow these steps to configure the Adjust SDK for iOS devices. + +### Link additional frameworks {% #link-frameworks %} + +Link the following frameworks to your Xcode project to give the Adjust SDK access to device-level information. + +| Framework | Purpose | Notes | +| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `AdSupport.framework` | Required to enable the Adjust SDK to read the device IDFA. | You MUST NOT add this framework if your app targets the "Kids" category | +| `AdServices.framework` | Required for handling Apple Search Ads | | +| `StoreKit.framework` | Required to access the SKAdNetwork framework and for the Adjust SDK to handle communications with SKAdNetwork. | | +| `AppTrackingTransparency.framework` | Required in iOS 14 and later to enable the Adjust SDK to wrap the ATT consent dialog and access the user's consent response. | You SHOULD NOT add this framework if your app targets the "Kids" category | + +### Copy additional source files {% #copy-source-files %} + +To complete iOS setup, you MUST copy all Objective-C++ (`.h` and `.mm`) files from the `dist` directory of the unzipped SDK archive to your Xcode project. Ensure that all `.mm` files are listed in the **Build Phases --> Compile Sources** section. + +### Update your app's privacy manifest {% #update-privacy-manifest %} + +To inform the App Store of the Adjust SDK's privacy requirements, you need to merge your privacy manifest with Adjust's privacy manifests. + +1. Add the [Adjust SDK privacy manifest](https://github.com/adjust/ios_sdk/blob/master/Adjust/PrivacyInfo.xcprivacy) properties to your app's privacy manifest. +1. Add the [Signature library privacy manifest](https://github.com/adjust/adjust_signature_sdk/blob/main/Resources/iOS/PrivacyInfo.xcprivacy) properties to your app's privacy manifest. + +## 6. Integrate the Adjust SDK {% #integrate-the-adjust-sdk %} + +Once you've updated your project settings, you can integrate the Adjust SDK into your app. To do this: + +1. Find your application delegate file in the **Project Navigator** and open it. + +1. Include the `Adjust/Adjust2dx.h` class at the top of the file. + +1. Instantiate an `AdjustConfig2dx` object with the following arguments: + + {% deflist %} + `appToken` (`std::string`) + + : Your Adjust app token + + `environment` (`std::string`) + + : Pass `AdjustEnvironmentSandbox2dx` to test your app in a sandbox environment. + {% /deflist %} + +1. Optionally adjust your [logging level](/en/sdk/cocos2dx/configuration#set-your-logging-level) to adjust the verbosity of your logging. + +1. Call the `Adjust2dx::initSdk` method and pass your `AdjustConfig2dx` instance as an argument as soon as possible after the app is launched. + +{% callout type="important" %} +When running tests you should ensure that your environment is set to `AdjustEnvironmentSandbox2dx`. Change this to `AdjustEnvironmentProduction2dx` before you submit your application to app stores. +{% /callout %} + +```cpp +#include "Adjust/Adjust2dx.h" + +std::string appToken = "{% $variables.config.token %}"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +adjustConfig.setLogLevel(AdjustLogLevel2dxVerbose); +Adjust2dx::initSdk(adjustConfig); +``` + +## 7. Build your app {% #build-your-app %} + +Well done! You should now be able to build and run your Cocos2d-x app. Enable logging to check for any issues. Check your logs to see the `Install tracked` message. + +You are ready to start attributing your users with the Adjust SDK. diff --git a/src/content/docs/sdk/migration/cocos2dx/index.mdoc b/src/content/docs/sdk/migration/cocos2dx/index.mdoc new file mode 100644 index 000000000..301861677 --- /dev/null +++ b/src/content/docs/sdk/migration/cocos2dx/index.mdoc @@ -0,0 +1,7 @@ +--- +title: Cocos2d-x +description: Follow these guides to migrate between SDK versions +slug: en/sdk/migration/cocos2dx +sidebar-position: 6 +type: category +--- diff --git a/src/content/docs/sdk/migration/cocos2dx/v4-to-v5.mdoc b/src/content/docs/sdk/migration/cocos2dx/v4-to-v5.mdoc new file mode 100644 index 000000000..3d0c26e19 --- /dev/null +++ b/src/content/docs/sdk/migration/cocos2dx/v4-to-v5.mdoc @@ -0,0 +1,717 @@ +--- +title: SDK v5 migration guide +description: Follow this guide to upgrade from SDK v4 to SDK v5 +slug: en/sdk/migration/cocos2dx/v4-to-v5 +sidebar-position: 1 +--- + +## Before you begin {% #before-you-begin %} + +Here's what you need to do before updating to SDK v5: + +1. The minimum supported API versions for SDK v5 have been updated. If your app targets a lower version, you need to update it first. + + - iOS: **12.0** + - Android: **21** + +## Install the SDK {% #install-the-sdk %} + +To start using SDK v5, you need to add it as a dependency in your project. To do this: + +1. Download the SDK archive [from GitHub](https://github.com/adjust/cocos2dx_sdk/releases) + +1. Copy the C++ files from the `dist` directory and add them to your Cocos2d-x project + +1. (**Android only**): add the paths of the C++ files to the `LOCAL_SRC_FILES` section of your `Android.mk` file. + + ```text + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustConfig2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustAttribution2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustProxy2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustEvent2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/Adjust2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustEventFailure2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustEventSuccess2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustSessionFailure2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustSessionSuccess2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustAppStoreSubscription2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustPlayStoreSubscription2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustThirdPartySharing2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustAdRevenue2dx.cpp + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustAppStorePurchase2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustPlayStorePurchase2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustDeeplink2dx.cpp \ + $(LOCAL_PATH)/../../../Classes/Adjust/AdjustPurchaseVerificationResult2dx.cpp \ + ``` + + If you're using CMake, add the following list of sources and headers to your `CMakeLists.txt` file: + + ```cmake + # add cross-platforms source files and header files + list(APPEND GAME_SOURCE + Classes/Adjust/AdjustConfig2dx.cpp + Classes/Adjust/AdjustAttribution2dx.cpp + Classes/Adjust/AdjustProxy2dx.cpp + Classes/Adjust/AdjustEvent2dx.cpp + Classes/Adjust/AdjustAdRevenue2dx.cpp + Classes/Adjust/AdjustAppStoreSubscription2dx.cpp + Classes/Adjust/AdjustPlayStoreSubscription2dx.cpp + Classes/Adjust/AdjustAppStorePurchase2dx.cpp + Classes/Adjust/AdjustPlayStorePurchase2dx.cpp + Classes/Adjust/Adjust2dx.cpp + Classes/Adjust/AdjustEventFailure2dx.cpp + Classes/Adjust/AdjustEventSuccess2dx.cpp + Classes/Adjust/AdjustSessionFailure2dx.cpp + Classes/Adjust/AdjustSessionSuccess2dx.cpp + Classes/Adjust/AdjustThirdPartySharing2dx.cpp + Classes/Adjust/AdjustDeeplink2dx.cpp + Classes/Adjust/AdjustPurchaseVerificationResult2dx.cpp + ) + list(APPEND GAME_HEADER + Classes/Adjust/AdjustConfig2dx.h + Classes/Adjust/AdjustAttribution2dx.h + Classes/Adjust/AdjustProxy2dx.h + Classes/Adjust/AdjustEvent2dx.h + Classes/Adjust/AdjustAdRevenue2dx.h + Classes/Adjust/AdjustAppStoreSubscription2dx.h + Classes/Adjust/AdjustPlayStoreSubscription2dx.h + Classes/Adjust/AdjustAppStorePurchase2dx.h + Classes/Adjust/AdjustPlayStorePurchase2dx.h + Classes/Adjust/Adjust2dx.h + Classes/Adjust/AdjustEventFailure2dx.h + Classes/Adjust/AdjustEventSuccess2dx.h + Classes/Adjust/AdjustSessionFailure2dx.h + Classes/Adjust/AdjustSessionSuccess2dx.h + Classes/Adjust/AdjustThirdPartySharing2dx.h + Classes/Adjust/AdjustDeeplink2dx.h + Classes/Adjust/AdjustPurchaseVerificationResult2dx.h + ) + ``` + +1. (**Android only**): download the latest `adjust-android.aar` from [the GitHub releases page](https://github.com/adjust/cocos2dx_sdk/releases/latest) and import it into your Android Studio project. + +1. (**iOS only**): download the latest `AdjustSdk.framework` from [the GitHub releases page](https://github.com/adjust/cocos2dx_sdk/releases/latest) and link it in your Xcode project. + +## Set up the Signature library {% #signature-setup %} + +SDK v5 uses the [SDK signature library](https://help.adjust.com/en/article/sdk-signature) to encrypt information sent from the Adjust SDK to Adjust's servers. You MUST add the signature library to your project to use SDK v5. + +### Android apps + +1. Download the latest `adjust-android-signature.aar` from [the Adjust Signature library GitHub repository](https://github.com/adjust/adjust_signature_sdk/releases/latest). +1. Add the `.aar` to your Android Studio project. + +### iOS apps + +1. Download the latest `AdjustSigSdk-iOS-Static.a` from [the Adjust Signature library GitHub repository](https://github.com/adjust/adjust_signature_sdk/releases/latest). +1. Link the `.a` in your Xcode project. + +## Update your app's privacy manifest (iOS only) {% #update-privacy-manifest %} + +To inform the App Store of the Adjust SDK's privacy requirements, you need to merge your privacy manifest with Adjust's privacy manifests. + +1. Add the [Adjust SDK privacy manifest](https://github.com/adjust/ios_sdk/blob/master/Adjust/PrivacyInfo.xcprivacy) properties to your app's privacy manifest. +1. Add the [Signature library privacy manifest](https://github.com/adjust/adjust_signature_sdk/blob/main/Resources/iOS/PrivacyInfo.xcprivacy) properties to your app's privacy manifest. + +## Update the initialization method {% #update-the-init-method %} + +{% minorversion changed="v5" size="large" /%} + +In SDK v4, the initialization method is `Adjust2dx::start(adjustConfig)`. This has been changed to `Adjust2dx::initSdk(adjustConfig)`. + +{% codeblock useDiffSyntax=true %} +```cpp +#include "Adjust/Adjust2dx.h" + +std::string appToken = "YourAppToken"; +std::string environment = AdjustEnvironmentSandbox2dx; + +AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment); +- Adjust2dx::start(adjustConfig); ++ Adjust2dx::initSdk(adjustConfig); +``` +{% /codeblock %} + +## Changed APIs {% #changed-apis %} + +{% minorversion changed="v5" size="large" /%} + +The following APIs have been changed in SDK v5. + +### Disable and enable the SDK {% #disable-enable-sdk %} + +In SDK v4, you can enable and disable the SDK by calling `Adjust2dx::setEnabled` with a `bool` value. + +```cpp +Adjust2dx::setEnabled(false); // disable SDK +Adjust2dx::setEnabled(true); // enable SDK +``` + +In SDK v5, this feature is split into separate commands for clarity. + +- Call `Adjust2dx::disable()` to disable the SDK. +- Call `Adjust2dx::enable()` to enable the SDK. + +```cpp +Adjust2dx::disable(); +Adjust2dx::enable(); +``` + +### Send information in background {% #send-in-background %} + +In SDK v4, you can set the `sendInBackground` property on your `adjustConfig` instance to `true` to enable the SDK to send information to Adjust while your app is running in the background. + +```cpp +adjustConfig.sendInBackground(true); +``` + +In SDK v5, you need to call the `enableSendingInBackground` method of your `adjustConfig` instance to enable the SDK to send information to Adjust while your app is running in the background. + +```cpp +adjustConfig.enableSendingInBackground(); +``` + +### Preinstalled app measurement {% #preinstalled-app %} + +In SDK v4, you can call the `setPreinstallTrackingEnabled` method of your `adjustConfig` instance with a `true` argument to enable measuring preinstalled apps. + +```cpp +adjustConfig.setPreinstallTrackingEnabled(true); +``` + +In SDK v5, you need to call the `enablePreinstallTracking` method of your `adjustConfig` instance to enable measuring preinstalled apps. + +```cpp +adjustConfig.enablePreinstallTracking(); +``` + +### Disable AdServices information reading {% #disable-adservices %} + +In SDK v4, you can call the `setAllowAdServicesInfoReading` method on your `adjustConfig` with the value `false` to prevent the Adjust SDK from reading AdServices information. + +```cpp +adjustConfig.setAllowAdServicesInfoReading(false); +``` + +In SDK v5, you need to call the `disableAdServices` method on your `adjustConfig` instance to prevent the Adjust SDK from reading AdServices information. The default state is `true`. + +```cpp +adjustConfig.disableAdServices(); +``` + +### Disable IDFA reading {% #disable-idfa %} + +In SDK v4, you can call the `setAllowIdfaReading` method on your `adjustConfig` with the value `false` to prevent the Adjust SDK from reading the device's IDFA. + +```cpp +adjustConfig.setAllowIdfaReading(false); +``` + +In SDK v5, you need to call the `disableIdfaReading` method on your `adjustConfig` instance to prevent the Adjust SDK from reading the device's IDFA. The default state is `true`. + +```cpp +adjustConfig.disableIdfaReading(); +``` + +### Enable cost data in attribution {% #enable-cost-data %} + +In SDK v4, you can call the `setNeedsCost` method on your `adjustConfig` instance with the value `true` to enable cost data in the device's attribution information. + +```cpp +adjustConfig.setNeedsCost(true); +``` + +In SDK v5, you need to call the `enableCostDataInAttribution` method on your `adjustConfig` instance to enable cost data in the device's attribution information. The default state is `false`. + +```cpp +adjustConfig.enableCostDataInAttribution(); +``` + +### Enable LinkMe {% #enable-linkme %} + +In SDK v4, you can call the `setLinkMeEnabled` method on your `adjustConfig` instance with the value `true` to enable [Adjust LinkMe](https://help.adjust.com/en/article/linkme). + +```cpp +adjustConfig.setLinkMeEnabled(true); +``` + +In SDK v5, you need to call the `enableLinkMe` method on your `adjustConfig` instance to enable [Adjust LinkMe](https://help.adjust.com/en/article/linkme). The default state is `false`. + +```cpp +adjustConfig.enableLinkMe(); +``` + +### Only read device IDs once {% #read-device-id-once %} + +In SDK v4, you can call the `setReadDeviceInfoOnceEnabled` method on your `adjustConfig` with the value `true` to instruct the SDK to only read device IDs once. + +```cpp +adjustConfig.setReadDeviceInfoOnceEnabled(true); +``` + +In SDK v5, you need to call the `enableDeviceIdsReadingOnce` method on your `adjustConfig` to instruct the SDK to only read device IDs once. The default state is `false`. + +```cpp +adjustConfig.enableDeviceIdsReadingOnce(); +``` + +### Offline mode {% #offline-mode %} + +In SDK v4, you can enable and disable offline mode the SDK by calling `Adjust2dx::setOfflineMode` with a `bool` argument. + +```cpp +Adjust2dx::setOfflineMode(true); +Adjust2dx::setOfflineMode(false); +``` + +In SDK v5, this feature is split into separate commands for clarity. + +- Call `Adjust2dx::switchToOfflineMode` to set the SDK to offline mode. +- Call `Adjust2dx::switchBackToOnlineMode` to set the SDK back to online mode. + +```cpp +Adjust2dx::switchToOfflineMode(); // Put the SDK in offline mode +Adjust2dx::switchBackToOnlineMode(); // Put the SDK back in online mode +``` + +### Session callback parameters {% #callback-params %} + +In SDK v4, you can add session callback parameters by passing a key-value pair to the `Adjust2dx::addSessionCallbackParameter` method and remove individual parameters using the `Adjust2dx::removeSessionCallbackParameter` method. + +```cpp +Adjust2dx::addSessionCallbackParameter("key", "value"); +Adjust2dx::removeSessionCallbackParameter("key"); +Adjust2dx::resetSessionCallbackParameters(); +``` + +In SDK v5, session callback parameters are renamed to global parameters. + +```cpp +Adjust2dx::addGlobalCallbackParameter("key", "value"); +Adjust2dx::removeGlobalCallbackParameter("key"); +Adjust2dx::removeGlobalCallbackParameters(); +``` + +### Session partner parameters {% #partner-params %} + +In SDK v4, you can add session partner parameters by passing a key-value pair to the `Adjust2dx::addSessionPartnerParameter` method and remove individual parameters using the `Adjust2dx::removeSessionPartnerParameter` method. + +```cpp +Adjust2dx::addSessionPartnerParameter("key", "value"); +Adjust2dx::removeSessionPartnerParameter("key"); +Adjust2dx::resetSessionPartnerParameters(); +``` + +In SDK v5, session partner parameters are renamed to global partner parameters. + +```cpp +Adjust2dx::addGlobalPartnerParameter("key", "value"); +Adjust2dx::removeGlobalPartnerParameter("key"); +Adjust2dx::removeGlobalPartnerParameters(); +``` + +### Event deduplication {% #event-deduplication %} + +In SDK v4, event deduplication is coupled with the event `transaction ID` and is limited to a maximum of 10 unique IDs. + +```cpp +adjustEvent.setTransactionId("transaction-id"); +``` + +In SDK v5, the feature is decoupled from `transaction ID`. A new ID field called `deduplicationId` has been added for event deduplication. + +```cpp +adjustEvent.setDeduplicationId("deduplication-id"); +``` + +You can set a custom limit on the number of `deduplicationId` that can be added to the list for identifying duplicate events. By default, the limit is set to **10**. + +```cpp +AdjustConfig2dx adjustConfig = AdjustConfig2dx("appToken", AdjustEnvironmentSandbox2dx); +adjustConfig.setEventDeduplicationIdsMaxSize(20); +Adjust2dx::initSdk(adjustConfig); +``` + +### App Store Subscriptions {% #app-store-subscriptions %} + +In SDK v4, you can set a new subscription by configuring an `AdjustAppStoreSubscription2dx` object. This object is initialized with four arguments: `price`, `currency`, `transactionId`, and `receipt`. + +```cpp +AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx(price, currency, transactionId, receipt); +``` + +In SDK v5, you don't need to pass the `receipt` argument as it's no longer needed for purchase verification. + +```cpp +AdjustAppStoreSubscription2dx subscription = AdjustAppStoreSubscription2dx(price, currency, transactionId); +``` + +### Reattribution using deep links {% #reattribution-using-deep-links %} + +In SDK v4, you can pass your deep link information to the `Adjust2dx::appWillOpenUrl` method. + +```cpp +Adjust2dx::appWillOpenUrl("url"); +``` + +In SDK v5, this has been renamed to `Adjust2dx::processDeeplink` for clarity. A new `AdjustDeeplink2dx` class has been added for constructing deep links. To process a deep link, instantiate an `AdjustDeeplink2dx` object with your deep link URL and pass it to the `Adjust2dx::processDeeplink` method. + +```cpp +AdjustDeeplink2dx deeplink = AdjustDeeplink2dx("url"); +Adjust2dx::processDeeplink(deeplink); +``` + +### Deep link resolution {% #deeplink-resolution %} + +In SDK v4, you can resolve a shortened deep link by passing the `url` to the `Adjust2dx::processDeeplink` method. + +```cpp +Adjust2dx::processDeeplink("url", [](std::string resolvedLink) { + std::cout << "Resolved link: " << resolvedLink; +}); +``` + +In SDK v5, you need to send an `AdjustDeeplink2dx` object initialized with the deep link `url`. This returns the original unshortened deep link. + +```cpp +AdjustDeeplink2dx deeplink = AdjustDeeplink2dx("url"); +Adjust2dx::processDeeplink(deeplink, [](std::string resolvedLink) { + std::cout << "Resolved link: " << resolvedLink; +}); +``` + +### COPPA compliance {% #coppa-compliance %} + +In SDK v4, you can call the `coppaCompliantEnabled` method on your `adjustConfig` instance with the value `true` to enable COPPA compliance. + +```cpp +adjustConfig.setCoppaCompliantEnabled(true); +``` + +In SDK v5, you need to call the `enableCoppaCompliance` method on your `adjustConfig` instance to enable COPPA compliance. The default state is `false`. + +```cpp +adjustConfig.enableCoppaCompliance(); +``` + +### Play Store Kids Apps {% #play-store-kids %} + +In SDK v4, you can mark an app as a [Play Store Kids app](/en/sdk/react-native/features/privacy#play-store-kids-apps-android-only) by calling the `setPlayStoreKidsAppEnabled` method on your `adjustConfig` instance with the value `true`. This is read during SDK initialization, which means that the value can't be updated once the SDK is initialized. + +```cpp +adjustConfig.setPlayStoreKidsAppEnabled(true); +``` + +In SDK v5, you need to call the `enablePlayStoreKidsCompliance` method of your `adjustConfig` instance to enable compliance. The default state is `false`. + +```cpp +adjustConfig.enablePlayStoreKidsCompliance(); +``` + +### Set data residency and URL strategy {% #url-strategy %} + +In SDK v4, URL strategy and data residency domains are defined as constants in the `AdjustConfig` class. + +```cpp +adjustConfig.setUrlStrategy(AdjustDataResidencyEU); +``` + +In SDK v5, you need to pass your chosen domain or domains as an array. You need to also set the following: + +- `useSubdomains` (`bool`): Whether the domain should be treated as an Adjust domain. If `true`, the SDK will prefix the domains with Adjust-specific subdomains. If `false`, the SDK will use the provided domain as-is, without adding any prefixes. +- `isDataResidency` (`bool`): Whether the domain should be used for data residency. + +```cpp +adjustConfig.setUrlStrategy({"eu.adjust.com"}, true, true); +``` + +Check the table below to see how to configure your URL strategy in SDK v5. + +| v4 | v5 - main and fallback domain | v5 - use sub domains | v5 - is Data Residency | +| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | +| `AdjustDataResidencyEU` | `"eu.adjust.com"` | `true` | `true` | +| `AdjustDataResidencyTR` | `"tr.adjust.com"` | `true` | `true` | +| `AdjustDataResidencyUS` | `"us.adjust.com"` | `true` | `true` | +| `AdjustUrlStrategyChina` | `"adjust.world"`, `"adjust.com"` | `true` | `false` | +| `AdjustUrlStrategyCn` | `"adjust.cn"`, `"adjust.com"` | `true` | `false` | +| `AdjustUrlStrategyCnOnly` | `"adjust.cn"` | `true` | `false` | +| `AdjustUrlStrategyIndia` | `"adjust.net.in"`, `"adjust.com"` | `true` | `false` | + +#### Examples {% #examples %} + +```cpp +// India URL strategy +adjustConfig.setUrlStrategy({"adjust.net.in", "adjust.com"}, true, false); + +// China URL strategy +adjustConfig.setUrlStrategy({"adjust.world", "adjust.com"}, true, false); + +// China only URL strategy +adjustConfig.setUrlStrategy({"adjust.cn"}, true, false); + +// EU URL strategy +adjustConfig.setUrlStrategy({"eu.adjust.com"}, true, true); + +// Turkey URL strategy +adjustConfig.setUrlStrategy({"tr.adjust.com"}, true, true); + +// US URL strategy +adjustConfig.setUrlStrategy({"us.adjust.com"}, true, true); +``` + +### Record ad revenue {% #record-ad-revenue %} + +In SDK v4, you can record ad revenue by instantiating an `AdjustAdRevenue2dx` object with an ad revenue source constant. + +```cpp +AdjustAdRevenue2dx adRevenue = AdjustAdRevenue2dx(AdjustAdRevenueSourceAppLovinMAX); +``` + +In SDK v5, you need to instantiate an `AdjustAdRevenue` object with a string `source`. + +```cpp +AdjustAdRevenue2dx adRevenue = AdjustAdRevenue2dx("applovin_max_sdk") +``` + +| v4 | v5 | +| --------------------------------------- | --------------------------------------- | +| `AdjustAdRevenueSourceAppLovinMAX` | `"applovin_max_sdk"` | +| `AdjustAdRevenueSourceAdMob` | `"admob_sdk"` | +| `AdjustAdRevenueSourceIronSource` | `"ironsource_sdk"` | +| `AdjustAdRevenueSourceAdMostSource` | `"admost_sdk"` | +| `AdjustAdRevenueSourceUnity` | `"unity_sdk"` | +| `AdjustAdRevenueSourceHeliumChartboost` | `"helium_chartboost_sdk"` | +| `AdjustAdRevenueSourceAdx` | `"adx_sdk"` | +| `AdjustAdRevenueSourcePublisher` | `"publisher_sdk"` | +| `AdjustAdRevenueSourceTopOn` | `"topon_sdk"` | +| `AdjustAdRevenueSourceMopub` | No longer supported | + +### Disable SKAdNetwork communication {% #disable-skan %} + +In SDK v4, you can prevent the SDK from communicating with SKAdNetwork by calling the `adjustConfig.deactivateSKAdNetworkHandling` method. + +```cpp +adjustConfig.deactivateSKAdNetworkHandling(); +``` + +In SDK v5, you need to call the `disableSkanAttribution` method on your `adjustConfig` instance to disable SKAdNetwork communication. The default state is `true`. + +```cpp +adjustConfig.disableSkanAttribution(); +``` + +### Listen for conversion value updates {% #listen-for-cv-updates %} + +In SDK v4, you can call the `setPostbackConversionValueUpdatedCallback` method on your `adjustConfig` to listen for conversion value updates. Before SKAN4, you could use the `setConversionValueUpdatedCallback` method. + +```cpp +// pre-SKAN4 callback +adjustConfig.setConversionValueUpdatedCallback([](int conversionValue) { + std::cout << "\nConversion value: " << conversionValue; +}); +// SKAN4 callback +adjustConfig.setPostbackConversionValueUpdatedCallback([]( + int conversionValue, + std::string coarseValue, + bool lockWindow) { + std::cout << "\nConversion value: " << conversionValue; + std::cout << "\nCoarse value: " << coarseValue; + std::cout << "\nLock window: " << lockWindow; +}); +``` + +In SDK v5, you need to assign a callback function to the `setSkanUpdatedCallback` method of your `adjustConfig` object. + +```cpp +adjustConfig.setSkanUpdatedCallback([]( + std::unordered_map data) { + std::cout << "\nConversion value: " << data["conversionValue"]; + std::cout << "\nCoarse value: " << data["coarseValue"]; + std::cout << "\nLock window: " << data["lockWindow"]; + std::cout << "\nError: " << data["error"]; +}); +``` + +### Update conversion values {% #update-cvs %} + +In SDK v4, you can use one of these methods to send updated conversion values to Adjust: + +```cpp +// pass just the conversion value (deprecated method) +Adjust2dx::updateConversionValue(6); + +// pass the conversion value and a callback to receive a message about potential error +Adjust2dx::updatePostbackConversionValue(6, [](std::string error) { + std::cout << "Error while updating conversion value: " << error; +}); + +// SKAN 4.0 +// pass the conversion value, coarse value and a callback to receive a message about potential error +Adjust2dx::updatePostbackConversionValue(6, "low", [](std::string error) { + std::cout << "Error while updating conversion value: " << error; +}); + +// SKAN 4.0 +// pass the conversion value, coarse value, lock window and a callback to receive a message about potential error +Adjust2dx::updatePostbackConversionValue(6, "low", false, [](std::string error) { + std::cout << "Error while updating conversion value: " << error; +}); +``` + +To update conversion values in SDK v5, use the `updateSkanConversionValue` method with the following arguments: + +- `conversionValue` (`int`): The updated conversion value +- `coarseValue` (`std::string`): The updated [coarse conversion value](https://developer.apple.com/documentation/storekit/skadnetwork/coarseconversionvalue) +- `lockWindow` (`bool`): Whether to send the postback before the conversion window ends + +```cpp +Adjust2dx::updateSkanConversionValue(6, "low", true, [](std::string error) { + std::cout << "Error while updating conversion value: " << error; +}); +``` + +### App Tracking Transparency authorization wrapper {% #att-wrapper %} + +In SDK v4, you can handle changes to a user's ATT authorization status using the `Adjust2dx::requestTrackingAuthorizationWithCompletionHandler` method. + +```cpp +Adjust2dx::requestTrackingAuthorizationWithCompletionHandler([] (int status) { + switch (status) { + case 0: + // ATTrackingManagerAuthorizationStatusNotDetermined case + break; + case 1: + // ATTrackingManagerAuthorizationStatusRestricted case + break; + case 2: + // ATTrackingManagerAuthorizationStatusDenied case + break; + case 3: + // ATTrackingManagerAuthorizationStatusAuthorized case + break; + } +}); +``` + +This has been renamed to `Adjust2dx::requestAppTrackingAuthorization` in SDK v5 for clarity. + +```cpp +Adjust2dx::requestAppTrackingAuthorization([] (int status) { + switch (status) { + case 0: + // ATTrackingManagerAuthorizationStatusNotDetermined case + break; + case 1: + // ATTrackingManagerAuthorizationStatusRestricted case + break; + case 2: + // ATTrackingManagerAuthorizationStatusDenied case + break; + case 3: + // ATTrackingManagerAuthorizationStatusAuthorized case + break; + } +}); +``` + +### Get device information {% #device-info %} + +In SDK v4, all device information getter methods run synchronously. In SDK v5, these methods have been changed to run asynchronously. You can add a callback function to handle the information when the asynchronous process completes + +```cpp +// IDFA getter +Adjust2dx::getIdfa([](std::string idfa) { + std::cout << "\nIDFA = " << idfa; +}); + +// IDFV getter +Adjust2dx::getIdfv([](std::string idfv) { + std::cout << "\nIDFV = " << idfa; +}); + +// ADID getter +Adjust2dx::getAdid([](std::string adid) { + std::cout << "\nAdjust ID = " << adid; +}); + +// Attribution getter +Adjust2dx::getAttribution([](AdjustAttribution2dx attribution) { + // process attribution +}); + +// Enabled status getter +Adjust2dx::isEnabled([](bool isEnabled) { + // process isEnabled +}); + +// SDK version getter +Adjust2dx::getSdkVersion([](std::string sdkVersion) { + std::cout << "\nSDK version = " << sdkVersion; +}); + +// Last deep link getter +Adjust2dx::getLastDeeplink([](std::string lastDeeplink) { + std::cout << "\nLast deeplink = " << lastDeeplink; +}); +``` + +## Removed APIs {% #removed-apis %} + +{% minorversion removed="v5" size="large" /%} + +The following APIs have been removed in SDK v5. + +### Event buffering {% #event-buffering %} + +SDK v4 supports event buffering. This feature stores requests event, ad revenue, push tokens, and other information on a local buffer to send at a later date. + +```cpp +adjustConfig.setEventBufferingEnabled(true); +``` + +This setting has been removed in SDK v5. + +### Custom user agent string {% #custom-user-agent %} + +SDK v4 supports setting a custom User Agent by calling `adjustConfig.setUserAgent` with a user agent string. + +```cpp +adjustConfig.setUserAgent("custom-user-agent"); +``` + +This setting has been removed in SDK v5. + +### Set whether a device is known {% #set-device-known %} + +In SDK v4, you can call the `adjustConfig.setDeviceKnown` method to manually inform the SDK whether a device is known. + +```cpp +adjustConfig.setDeviceKnown(true); +``` + +This setting has been removed in SDK v5. + +### Delay SDK start {% #delay-sdk-start %} + +SDK v4 supports delaying the start of the SDK by calling `adjustConfig.setDelayStart` with up to **10 seconds** of delay. + +```cpp +adjustConfig.setDelayStart(10); +``` + +This method has been removed in SDK v5. The `Adjust2dx::sendFirstPackages()` method that interrupts this delay has also been removed. + +### Disable third party sharing globally {% #disable-sharing-globally %} + +In SDK v4, you can call the `Adjust2dx::disableThirdPartySharing` method to globally disable sharing information with third parties globally. + +```cpp +Adjust2dx::disableThirdPartySharing(); +``` + +This feature has been removed from SDK v5. In SDK v5, use the `Adjust2dx::trackThirdPartySharing` method to enable or disable third party sharing. + +```cpp +AdjustThirdPartySharing2dx thirdPartySharing = AdjustThirdPartySharing2dx(false); +Adjust2dx::trackThirdPartySharing(thirdPartySharing); +``` diff --git a/src/integrations/fetchSdkVersions.ts b/src/integrations/fetchSdkVersions.ts index 50c3308fb..fd9e50319 100644 --- a/src/integrations/fetchSdkVersions.ts +++ b/src/integrations/fetchSdkVersions.ts @@ -27,6 +27,10 @@ let versionReplacements: VersionMap = { v4: "vx.x.x", v5: "vx.x.x", }, + cocos2dx: { + v4: "vx.x.x", + v5: "vx.x.x", + }, web: "vx.x.x", windows: "vx.x.x", }; diff --git a/src/styles/index.css b/src/styles/index.css index 877bed20f..272b08f22 100644 --- a/src/styles/index.css +++ b/src/styles/index.css @@ -133,7 +133,14 @@ body { } .article-content a { - @apply text-inherit text-link-active font-link items-center underline-offset-2; + @apply text-inherit text-link-active font-link underline-offset-2; +} + +.article-content dd a, +.article-content dd code:not(a > code), +.article-content li a, +.article-content li code { + @apply mx-1; } bold { @@ -144,6 +151,16 @@ blockquote { @apply my-8 py-5 px-6 leading-[1.7] rounded-[0_0.25rem_0.25rem_0] bg-quote border-l-[3px] border-l-gray-40; } +/* Definition */ + +.article-content dl { + @apply bg-zinc-100 rounded-md pt-4 px-4 pb-1 mb-7; +} + +.article-content li > dl { + @apply mt-7 ml-4; +} + /* Tables */ .article-content table { @@ -190,12 +207,12 @@ blockquote { .article-content .badge { font-family: - BlinkMacSystemFont, - -apple-system, - "Segoe UI", - Roboto, - Arial, - sans-serif; + BlinkMacSystemFont, + -apple-system, + "Segoe UI", + Roboto, + Arial, + sans-serif; @apply inline-flex items-center justify-center align-middle rounded-3xl gap-x-2; } @@ -266,17 +283,21 @@ blockquote { } code { - @apply text-sm bg-code rounded-md px-1 py-[0.1rem] break-words; + @apply text-sm bg-blue-30 rounded-md px-1 py-[0.1rem] break-words; } .article-content iframe { @apply w-full h-auto aspect-video; } +.article-content li > input { + @apply mr-2; +} + /* Links */ a > code { - @apply relative bg-transparent underline-offset-2 text-gray-30 before:content-none before:absolute before:top-0 before:right-0 before:bottom-0 before:left-0 before:block before:bg-blue before:opacity-15 before:rounded-[3px]; + @apply relative bg-transparent underline-offset-2 before:content-none before:absolute before:top-0 before:right-0 before:bottom-0 before:left-0 before:block before:bg-blue before:opacity-15 before:rounded-[3px]; } a { diff --git a/src/variables.json b/src/variables.json new file mode 100644 index 000000000..6ba733f9d --- /dev/null +++ b/src/variables.json @@ -0,0 +1,71 @@ +{ + "config": { + "token": "{YOUR_APP_TOKEN}", + "externalDeviceId": "1a42b171-faa5-46da-b5ae-6f4be6d05167", + "defaultLink": "abc123", + "attWaitingInterval": "30", + "fbAppId": "{YOUR_FB_APP_ID}", + "defaultTracker": "{YOUR_LINK_TOKEN}", + "preinstallFilePath": "../EngagementFile.xml" + }, + "ids": { + "gps_adid": "5962dfc1-3a53-4692-850b-22c4bf4311a5", + "android_uuid": "781f17d5-5048-4fae-a4e5-77b58bab62b9", + "idfa": "f6e44e82-1289-460d-b251-890d5815e235" + }, + "event": { + "token": "{YOUR_EVENT_TOKEN}", + "revenue": { + "amount": "0.25", + "currency": "EUR" + }, + "deduplicationId": "5e85484b-1ebc-4141-aab7-25b869e54c49", + "callbackId": "f2e728d8-271b-49ab-80ea-27830a215147", + "productId": "58112286-9fc4-4ba3-9aaa-dd5c69be3e49", + "purchaseToken": "07b946ed-4204-4fa0-8424-6c47413a7df3", + "transactionId": "7d9c2e12-b2ea-4be4-96cf-bd90d8f062fb", + "callbackParams": [ + "\"event_token\", \"g3mfiw\"", + "\"revenue_amount\", \"0.25\"" + ], + "partnerParams": ["\"product_id\", \"29\"", "\"user_id\", \"835\""], + "callbackParamsJson": [ + "\"event_token\": \"g3mfiw\"", + "\"revenue_amount\": \"0.25\"" + ], + "partnerParamsJson": ["\"product_id\": \"29\"", "\"user_id\": \"835\""] + }, + "adRevenue": { + "source": "applovin_max_sdk", + "revenue": { + "amount": "1.00", + "currency": "EUR" + }, + "adImpressionsCount": "10", + "adRevenueNetwork": "network1", + "adRevenueUnit": "unit1", + "adRevenuePlacement": "banner", + "callbackParams": ["\"key1\", \"value1\"", "\"key2\", \"value2\""], + "partnerParams": ["\"key3\", \"value3\"", "\"key4\", \"value4\""] + }, + "subscription": { + "appStoreSubscription": { + "price": "\"1.00\"", + "currency": "\"EUR\"", + "transactionId": "\"44da840e-3f70-4bc0-95d2-4b9638e1d7eb\"", + "salesRegion": "\"US\"", + "transactionDate": "\"txn_20230918T123456Z\"" + }, + "playStoreSubscription": { + "price": "\"1.00\"", + "currency": "\"EUR\"", + "sku": "\"47411084-12dd-41f6-9e4b-2c59e380945e\"", + "orderId": "\"63469457-d777-4698-9957-f07a3d14c7bf\"", + "signature": "\"1c37d91e-a3e6-4236-90a7-86c69051fc39\"", + "purchaseToken": "\"4afa8869-0dc6-43ff-be28-d07d454cb357\"", + "purchaseTime": "\"txn_20230918T123456Z\"" + }, + "key1": ["\"key\", ", "\"value\""], + "key2": ["\"foo\", ", "\"bar\""] + } +}