Choose a sign up flow
An important decision with AFP is to choose a sign up flow to onboard your users. The purpose of the sign up is to allow your users to create a new AdSense account (or sign in to an existing AdSense account) and link it to your platform. The option you choose will depend on the technical resources you want to invest in development and the onboarding experience you want to provide for your users.
Option 1: API-less flow
Option 1 requires the fewest technical resources as it doesn't use an API. You will only need a web developer to build the user interface within your platform. However, the trade-off is that this option requires your users to take more steps to complete the signup flow.
Overview of the API-less signup flow
Implementation
To implement an API-less signup flow, you need to provide a UI component for AdSense monetization. For example, on the page where your users access their "user profile" or "account settings", add a monetization page that includes the following:
- A short description of AdSense and how it interacts with your platform. Users should be completely aware that they're either signing up for a new AdSense account or using their existing AdSense account.
- Information about the AdSense Program policies. All users who sign up should be aware of the AdSense Program and its policies.
- The revenue share that your users will receive. It's important to explicitly show users what percentage of the AdSense revenue you will keep and what percentage the publisher will keep. AdSense will additionally show this information during the onboarding flow.
- A "Connect AdSense" button. This button will open a new tab and take the user to the correct page in AdSense depending on whether or not they have an existing AdSense account.
Example custom URL:
https://www.google.com/adsense/signup?url={platform-site-url}
Note: Google will provide you with the URL of the custom signup page, and help you define the contents of the URL variable. - An input box to collect and store the user’s AdSense publisher ID. After a user visits the link above, they will need to copy and paste their publisher ID into this input box.
Important: It's critical that you store the user’s publisher ID so that you can tag the user's content pages with the correct publisher information. See the Add the ad tag to your pages for more information.
Make sure you validate the inputted string. The format of a publisher ID is:pub-1234567890987654
Or in regex terms:pub\-\d{16}
Important: Some AdSense users may paste their publisher ID without clicking on the "Connect AdSense" button. It's important to let users know that the Sites page in their AdSense account needs to have the platform domain listed before ads can be served. This is the primary purpose of this button. - The user's tagging status. Users will want to know whether their ad code has been placed on their pages or not. As part of the user experience, let your users know when you've tagged their pages with their AdSense publisher ID. You can additionally populate the child account meta tag which will assist AdSense during the site verification steps. This also removes the need to publish ad tags on their pages on the user's behalf.
Option 2: Semi-assisted API flow
Option 2 uses the AdSense Management API to slightly simplify the signup flow. It requires more technical resources but reduces the number of steps your users need to take to sign up for AdSense.
Overview of the semi-assisted API flow
Implementation
To implement a semi-assisted signup flow with an API, you need to provide a UI component for AdSense monetization. For example, on the page where your users access their "user profile" or "account settings", add a monetization page that includes the following:
- A short description of AdSense and how it interacts with your platform. Users should be completely aware that they are signing up for a Google AdSense account, or using their existing AdSense account.
- Information about the AdSense Program policies. All users who sign up should be aware of the AdSense Program and its policies.
- The revenue share that your users will receive. It's important to explicitly show users what percentage of the AdSense revenue you will keep and what percentage the publisher will keep. AdSense will additionally show this information during the onboarding flow.
- A "Connect AdSense" button. This button will authorize you as the platform to access an AdSense customer's account information using the AdSense Management API. Please follow the instructions on our developer documentation to set this up. Using this API you can perform the next two steps.
- Use the AdSense Management API to collect the user's AdSense publisher ID. Make sure you validate the inputted string.
The format of a publisher ID is:pub-1234567890987654
Or in regex terms:pub\-\d{16}
Important: It's critical that you store the user’s publisher ID so that you can tag the user's content pages with the correct publisher information. See the See the Add the ad tag to your pages for more information. - Use the AdSense Management API to check if the user has added the platform site to their AdSense account. If not, ask the user to follow the link below to complete the set up. The name of the site you should check for in the API is the
{platform-site-url}
variable in the link below.
https://www.google.com/adsense/signup?url={platform-site-url}
Note: Google will provide you with the URL of the custom signup page, and help you define the contents of the url variable. - - The user's tagging status. Users will want to know whether their ad code has been placed on their pages or not. As part of the user experience, let your users know when you've tagged their pages with their AdSense publisher ID. You can additionally populate the child account meta tag which will assist AdSense during the site verification steps. This also removes the need to publish ad tags on their pages on the user's behalf.
Option 3: Embedded Connect
Embedded Connect removes all the complexity of dealing with AdSense accounts in different states. Depending on the account, ad client and site statuses for a given user's AdSense account, the Embedded Connect flow will present a customized onboarding experience for each user so that you don't have to.
The implementation involves a JavaScript library, an empty div where AdSense will render a sign-up widget, and some callback functions which will allow you to save the publisher ID once the user has completed the sign-up flow. You can supplementally use the AdSense Management API to augment the experience, for example by retrieving ad units or the state of Auto ads.