Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(adsense)!: remove default data-ad-format #248

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

asokawotulo
Copy link
Contributor

@asokawotulo asokawotulo commented Sep 5, 2024

πŸ”— Linked issue

Resolves #247

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Removed the default ad format, allowing for fixed-size ad units

Copy link

vercel bot commented Sep 5, 2024

@asokawotulo is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@@ -37,9 +36,7 @@ const instance = useScriptGoogleAdsense({
const { status } = instance

onMounted(() => {
callOnce(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did do this for a reason πŸ€”

Possibly because in dev the HMR was triggering a new ad each time.

We might need to track which ads we've pushed an object for if we're going to remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I'll try play around and see if I can come up with a solution for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@harlan-zw Just an idea, what if we use callOnce only in dev, but in production, we push every time the component is mounted.

Something along the lines of:

function pushAdSlot() {
  (window.adsbygoogle = window.adsbygoogle || []).push({})
}

onMounted(() => {
  import.meta.dev
    ? callOnce(() => {
        pushAdSlot()
      })
    : pushAdSlot()

  // ...
})

@@ -14,7 +14,6 @@ const props = withDefaults(defineProps<{
*/
trigger?: ElementScriptTrigger
}>(), {
dataAdFormat: 'auto',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with this change but as it's a breaking change it would need to wait until 0.9.0 so maybe better to have it in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright let me revise the PR

@asokawotulo asokawotulo changed the title fix(adsense)!: remove default data-ad-format and allow for more than one ad slot on the page fix(adsense)!: remove default data-ad-format Sep 5, 2024
@harlan-zw harlan-zw merged commit 81b2498 into nuxt:main Sep 9, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google Adsense: Fixed size display unit
2 participants