amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-analytics: Added support for extraUrlParamsReplaceMap defined in a trigger block.

Open dougscher opened this issue 7 years ago • 10 comments

This will add efficiency and better organization of param replacements that are only associated with specific triggers.

Similar use case as with: Added support for extraUrlParams in trigger blocks and URL vars. #3168

dougscher avatar Mar 25 '18 04:03 dougscher

/to @zhouyx

aghassemi avatar Apr 09 '18 22:04 aghassemi

@dougscher You are suggesting adding extraUrlParamsReplaceMap to trigger config as well as the extraUrlParams. What to do with global extraUrlParamsReplaceMap and trigger level extraUrlParamsReplaceMap? Shall we combine the values and override config level value with trigger level value? Could you please share your detail use case?

zhouyx avatar Jul 16 '18 21:07 zhouyx

Right now, we use extraUrlParamsReplaceMap to allow url params to be specified by the user as a meaningful name: articleId: 'artid',

So the user does not have to deal with the cryptic names that are actually used in the event url. This could be done with variables, but then we would be sending a lot of empty url params if they are not used, same example: &artid=""

Right now extraUrlParamsReplaceMap is limited to 16 entries for some reason. bumping that to maybe 40 would take us a long way.

Also allowing extraUrlParamsReplaceMap to be specified to a specific trigger would allow controlling these sets of parameters to only apply to specific events.

dougscher avatar Sep 06 '18 21:09 dougscher

@rudygalfi Do you maybe have some context on why we put the 16 entries limit to extraUrlParamsReplaceMap. from #1932

zhouyx avatar Sep 07 '18 22:09 zhouyx

This issue hasn't been updated in awhile. @zhouyx Do you have any updates?

ampprojectbot avatar Dec 12 '18 08:12 ampprojectbot

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 24 '20 03:12 stale[bot]

This issue hasn't been updated in awhile. @zhouyx Do you have any updates? This change would fix some challenges we have with our implementation.

dougscher avatar Dec 24 '20 18:12 dougscher

I think expanding the limit from 16 to 40 is reasonable. I also think that extraUrlParamsReplaceMap should only be defined by analytics vendors. Maybe a good approach is to remove the count limit check, but disallow the configuration of extraUrlParamsReplaceMap inline.

cc @jeffjose

zhouyx avatar Dec 29 '20 00:12 zhouyx

From a performance standpoint, increasing the limit from 16 to 40 doesn't seem like it will be immensely impactful.

However, removing inline support seems a little risky though since some pubs might have custom inline replace maps.

I would prefer to only add support for extraUrlParamsReplaceMap within a trigger block:

  • If an extraUrlParamsReplaceMap is defined in a trigger block, then we will use it to preprocess the extraUrlParams within the trigger block
  • Top level extraUrlParams will not be affected by trigger level extraUrlParamsReplaceMap

@dougscher Would this be sufficient for your use case?

micajuine-ho avatar Dec 29 '20 19:12 micajuine-ho

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 19 '25 08:07 stale[bot]