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

Help with AMP setup - #112

Open
tinchisla opened this issue Oct 3, 2022 · 0 comments
Open

Help with AMP setup - #112

tinchisla opened this issue Oct 3, 2022 · 0 comments

Comments

@tinchisla
Copy link

Hi there,
I've use this tool for Standard creatives and it worked perfect. Now I'm trying to do the same for AMP.

In create_creatives.py, I've added just two lines in:

def create_creative_config(name, advertiser_id, video_ad_type, redirect_url):

snippet_file_path = os.path.join(os.path.dirname(__file__), "creative_snippet.html")
with open(snippet_file_path, "r") as snippet_file:
    snippet = snippet_file.read()

# https://developers.google.com/doubleclick-publishers/docs/reference/v201802/CreativeService.Creative
config = {
    "xsi_type": "ThirdPartyCreative",
    "name": name,
    "advertiserId": advertiser_id,
    "size": {"width": "1", "height": "1"},
    "snippet": snippet,
    "isSafeFrameCompatible": False,
    # la siguiente línea solo es en caso de AMP - comentar en caso de un creativo común
    "ampRedirectUrl": "https://acceleratedmobilepageurl.googleapis.com/v1/ampUrls:batchGet", # FIRST LINE
}

if video_ad_type:
    config["xsi_type"] = "VastRedirectCreative"
    config["duration"] = 1000
    config["size"] = {"width": "640", "height": "480"}
    config["vastXmlUrl"] = redirect_url
else:
    config["xsi_type"] = "ThirdPartyCreative"
    config["snippet"] = snippet
    config["isSafeFrameCompatible"] = False
    config["size"] = {"width": "1", "height": "1"}
      # la siguiente línea solo es en caso de AMP - comentar en caso de un creativo común

    config["ampRedirectUrl"] = "https://acceleratedmobilepageurl.googleapis.com/v1/ampUrls:batchGet" # SECOND LINE

return config

But, I'm getting this error:

k: self._PackArgumentsHelper(elem_arguments[k], v, set_type_attrs)

KeyError: 'ampRedirectUrl'

Definetely, I need help to config this for AMP. I really don't know what to do.
I could see that, I have to change the creative code type in GAM from Standard to Standard & AMP. I don't know how to do that with this tool. Is it possible?
Should I change anything else?

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

No branches or pull requests

1 participant